ngx-core-components 0.3.3 → 0.3.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.
- package/ai/ai-audio-wave/ai-audio-wave.component.d.ts +28 -0
- package/ai/ai-chat-widget/ai-chat-widget.component.d.ts +26 -0
- package/ai/ai-code-editor/ai-code-editor.component.d.ts +30 -0
- package/ai/ai-model-compare/ai-model-compare.component.d.ts +31 -0
- package/ai/ai-prompt-editor/ai-prompt-editor.component.d.ts +22 -0
- package/ai/public-api.d.ts +7 -0
- package/buttons/public-api.d.ts +2 -0
- package/buttons/speed-dial/speed-dial.component.d.ts +24 -0
- package/charts/area-chart/area-chart.component.d.ts +43 -0
- package/charts/funnel-chart/funnel-chart.component.d.ts +26 -0
- package/charts/gauge-chart/gauge-chart.component.d.ts +25 -0
- package/charts/heatmap-chart/heatmap-chart.component.d.ts +34 -0
- package/charts/public-api.d.ts +10 -0
- package/charts/radar-chart/radar-chart.component.d.ts +51 -0
- package/charts/treemap-chart/treemap-chart.component.d.ts +33 -0
- package/feedback/alert/alert.component.d.ts +19 -0
- package/feedback/avatar/avatar.component.d.ts +37 -0
- package/feedback/countdown/countdown.component.d.ts +46 -0
- package/feedback/empty-state/empty-state.component.d.ts +14 -0
- package/feedback/public-api.d.ts +9 -0
- package/feedback/stat-card/stat-card.component.d.ts +18 -0
- package/fesm2022/ngx-core-components-ai.mjs +1418 -2
- package/fesm2022/ngx-core-components-ai.mjs.map +1 -1
- package/fesm2022/ngx-core-components-buttons.mjs +133 -1
- package/fesm2022/ngx-core-components-buttons.mjs.map +1 -1
- package/fesm2022/ngx-core-components-charts.mjs +1474 -2
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
- package/fesm2022/ngx-core-components-feedback.mjs +973 -5
- package/fesm2022/ngx-core-components-feedback.mjs.map +1 -1
- package/fesm2022/ngx-core-components-inputs.mjs +1050 -12
- package/fesm2022/ngx-core-components-inputs.mjs.map +1 -1
- package/fesm2022/ngx-core-components-layout.mjs +930 -2
- package/fesm2022/ngx-core-components-layout.mjs.map +1 -1
- package/fesm2022/ngx-core-components-navigation.mjs +442 -2
- package/fesm2022/ngx-core-components-navigation.mjs.map +1 -1
- package/fesm2022/ngx-core-components-views.mjs +1626 -3
- package/fesm2022/ngx-core-components-views.mjs.map +1 -1
- package/fesm2022/ngx-core-components.mjs +8 -8
- package/fesm2022/ngx-core-components.mjs.map +1 -1
- package/inputs/file-preview/file-preview.component.d.ts +61 -0
- package/inputs/file-upload/file-upload.component.d.ts +51 -0
- package/inputs/public-api.d.ts +7 -0
- package/inputs/segmented-control/segmented-control.component.d.ts +20 -0
- package/inputs/tag-input/tag-input.component.d.ts +25 -0
- package/layout/carousel/carousel.component.d.ts +39 -0
- package/layout/dashboard-layout/dashboard-layout.component.d.ts +43 -0
- package/layout/dashboard-layout/models.d.ts +26 -0
- package/layout/drawer/drawer.component.d.ts +21 -0
- package/layout/public-api.d.ts +4 -0
- package/navigation/back-to-top/back-to-top.component.d.ts +15 -0
- package/navigation/command-palette/command-palette.component.d.ts +34 -0
- package/navigation/public-api.d.ts +3 -0
- package/package.json +1 -1
- package/public-api.d.ts +33 -9
- package/views/image-compare/image-compare.component.d.ts +26 -0
- package/views/kanban/kanban.component.d.ts +41 -0
- package/views/kanban/models.d.ts +19 -0
- package/views/key-value-list/key-value-list.component.d.ts +36 -0
- package/views/public-api.d.ts +11 -0
- package/views/scheduler/models.d.ts +18 -0
- package/views/scheduler/scheduler.component.d.ts +36 -0
- package/views/timeline/timeline.component.d.ts +19 -0
- package/views/virtual-list/virtual-list.component.d.ts +42 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, viewChild, effect, Component } from '@angular/core';
|
|
2
|
+
import { input, output, viewChild, effect, Component, signal, ViewChild, computed } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
@@ -488,9 +488,1425 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
488
488
|
`, styles: [":host{display:block;height:100%;font-family:var(--ngx-font-family, system-ui, -apple-system, sans-serif)}.ngx-ai-chat-container{display:flex;flex-direction:column;height:100%;background:var(--ngx-ai-chat-bg, #ffffff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;box-shadow:0 4px 20px #0000000d;transition:all .3s ease}.ngx-ai-chat-container.dark-mode{--ngx-ai-chat-bg: #1e293b;--ngx-ai-chat-border: #334155;--ngx-ai-header-bg: #0f172a;--ngx-ai-header-text: #f8fafc;--ngx-ai-bubble-user-bg: #3b82f6;--ngx-ai-bubble-user-text: #ffffff;--ngx-ai-bubble-assistant-bg: #334155;--ngx-ai-bubble-assistant-text: #f8fafc;--ngx-ai-input-bg: #0f172a;--ngx-ai-input-text: #f8fafc;--ngx-ai-input-border: #334155}.ngx-ai-chat-header{display:flex;align-items:center;padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-ai-chat-border, #e2e8f0);gap:12px}.header-avatar{position:relative;width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;font-size:14px}.header-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.status-indicator{position:absolute;bottom:0;right:0;width:10px;height:10px;border-radius:50%;background:#94a3b8;border:2px solid var(--ngx-ai-chat-bg, #fff)}.status-indicator.online{background:#10b981}.header-info{flex:1}.agent-title{font-weight:600;font-size:15px;color:var(--ngx-ai-header-text, #1e293b)}.agent-status{font-size:12px;color:#64748b}.header-actions{display:flex;gap:8px}.header-btn{background:none;border:none;padding:8px;border-radius:50%;cursor:pointer;color:#64748b;display:flex;align-items:center;justify-content:center;transition:background-color .2s}.header-btn:hover{background-color:#64748b1a}.svg-icon{width:20px;height:20px;fill:currentColor}.ngx-ai-chat-body{flex:1;overflow-y:auto;padding:16px 20px;display:flex;flex-direction:column}.messages-list{display:flex;flex-direction:column;gap:20px}.message-wrapper{display:flex;gap:12px;max-width:85%}.message-wrapper.user-msg{align-self:flex-end;flex-direction:row-reverse;max-width:75%}.message-wrapper.assistant-msg{align-self:flex-start}.msg-avatar{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:600;font-size:12px;flex-shrink:0}.msg-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.msg-bubble-container{display:flex;flex-direction:column;gap:4px}.user-msg .msg-bubble-container{align-items:flex-end}.msg-sender{font-size:11px;font-weight:600;color:#64748b;margin-left:4px}.msg-bubble{padding:12px 16px;border-radius:16px;font-size:14px;line-height:1.5;word-break:break-word}.user-msg .msg-bubble{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-text, #ffffff);border-bottom-right-radius:4px}.assistant-msg .msg-bubble{background:var(--ngx-ai-bubble-assistant-bg, #f1f5f9);color:var(--ngx-ai-bubble-assistant-text, #1e293b);border-bottom-left-radius:4px}.msg-text{white-space:pre-wrap}.msg-time{font-size:10px;color:#94a3b8;margin:0 4px}.agent-steps-container{margin-top:10px;border:1px solid rgba(148,163,184,.2);border-radius:8px;overflow:hidden;background:#ffffff0d}.steps-header{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:#94a3b81a;border-bottom:1px solid rgba(148,163,184,.1)}.steps-title-text{font-size:12px;font-weight:600;opacity:.8}.steps-badge{font-size:10px;font-weight:700;background:#94a3b833;padding:2px 6px;border-radius:10px}.steps-list{display:flex;flex-direction:column}.agent-step-item{border-bottom:1px solid rgba(148,163,184,.08)}.agent-step-item:last-child{border-bottom:none}.step-summary{display:flex;align-items:center;padding:8px 12px;cursor:pointer;font-size:12px;gap:8px;transition:background-color .2s}.step-summary:hover{background:#94a3b80d}.step-status-icon{width:16px;height:16px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#fff}.step-status-icon.success{background:#10b981}.step-status-icon.error{background:#ef4444}.step-status-icon.running{background:#3b82f6}.step-name{flex:1;font-weight:500}.step-duration{font-size:10px;opacity:.6}.step-chevron{font-size:8px;transition:transform .2s;opacity:.5}.step-chevron.expanded{transform:rotate(180deg)}.step-details{padding:8px 12px;background:#00000005;display:flex;flex-direction:column;gap:8px;border-top:1px solid rgba(148,163,184,.05)}.step-detail-section{display:flex;flex-direction:column;gap:4px}.detail-label{font-size:10px;font-weight:600;opacity:.6;text-transform:uppercase;letter-spacing:.3px}.detail-code{margin:0;padding:6px 10px;background:#0000000d;border-radius:4px;font-family:monospace;font-size:11px;overflow-x:auto;white-space:pre-wrap;max-height:120px}.cards-carousel{display:flex;gap:12px;overflow-x:auto;padding:10px 4px 6px;margin-top:8px;scroll-snap-type:x mandatory;scrollbar-width:thin}.cards-carousel::-webkit-scrollbar{height:6px}.cards-carousel::-webkit-scrollbar-thumb{background:#94a3b84d;border-radius:3px}.ai-carousel-card{flex:0 0 240px;background:var(--ngx-ai-chat-bg, #fff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;scroll-snap-align:start;box-shadow:0 2px 8px #0000000a}.card-img-container{height:120px;overflow:hidden}.card-img-container img{width:100%;height:100%;object-fit:cover}.card-body{padding:12px;display:flex;flex-direction:column;flex:1}.card-title{font-size:14px;font-weight:600;margin:0 0 2px}.card-subtitle{font-size:12px;font-weight:500;color:#64748b;margin:0 0 6px}.card-description{font-size:12px;color:#64748b;line-height:1.4;margin:0 0 12px;flex:1}.card-actions{display:flex;flex-direction:column;gap:6px}.card-action-btn{width:100%;padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:none;cursor:pointer;transition:all .2s}.card-action-btn.btn-primary{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border-color:transparent}.card-action-btn:hover{opacity:.9;transform:translateY(-1px)}.typing-bubble{display:flex;align-items:center;justify-content:center;padding:12px 20px}.typing-indicator{display:flex;gap:4px}.typing-indicator span{width:8px;height:8px;background:#94a3b8;border-radius:50%;animation:typing 1.4s infinite ease-in-out both}.typing-indicator span:nth-child(1){animation-delay:-.32s}.typing-indicator span:nth-child(2){animation-delay:-.16s}@keyframes typing{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.spinner{width:10px;height:10px;border:2px solid rgba(255,255,255,.3);border-radius:50%;border-top-color:#fff;animation:spin 1s ease-in-out infinite}@keyframes spin{to{transform:rotate(360deg)}}.quick-replies-container{padding:10px 16px 4px;background:transparent}.quick-replies-list{display:flex;gap:8px;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}.quick-replies-list::-webkit-scrollbar{display:none}.quick-reply-btn{flex:0 0 auto;padding:6px 14px;border-radius:18px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:var(--ngx-ai-chat-bg, #fff);font-size:13px;font-weight:500;color:#64748b;cursor:pointer;display:flex;align-items:center;gap:6px;transition:all .2s}.quick-reply-btn:hover{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-bg, #1a73e8);background-color:#1a73e80a}.ngx-ai-chat-footer{padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-top:1px solid var(--ngx-ai-chat-border, #e2e8f0)}.input-form{display:flex;gap:10px}.chat-input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid var(--ngx-ai-input-border, #cbd5e1);background:var(--ngx-ai-input-bg, #fff);color:var(--ngx-ai-input-text, #1e293b);font-size:14px;outline:none;transition:border-color .2s}.chat-input:focus{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8)}.send-btn{width:38px;height:38px;border-radius:8px;background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .2s,transform .1s}.send-btn:hover:not(:disabled){background-color:#1557b0;transform:translateY(-1px)}.send-btn:disabled{background-color:#94a3b8;cursor:not-allowed}\n"] }]
|
|
489
489
|
}], ctorParameters: () => [] });
|
|
490
490
|
|
|
491
|
+
class AIChatWidgetComponent {
|
|
492
|
+
agentName = input('AI Assistant');
|
|
493
|
+
icon = input('💬');
|
|
494
|
+
placeholder = input('Type a message...');
|
|
495
|
+
welcomeMessage = input('Hi! How can I help you today?');
|
|
496
|
+
quickReplies = input([]);
|
|
497
|
+
messageSent = output();
|
|
498
|
+
isOpen = signal(false);
|
|
499
|
+
messages = signal([]);
|
|
500
|
+
scrollContainer;
|
|
501
|
+
toggleOpen() {
|
|
502
|
+
this.isOpen.update(o => !o);
|
|
503
|
+
if (this.isOpen() && this.messages().length === 0) {
|
|
504
|
+
this.messages.set([
|
|
505
|
+
{ sender: 'assistant', text: this.welcomeMessage(), timestamp: new Date() }
|
|
506
|
+
]);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
closeOpen() {
|
|
510
|
+
this.isOpen.set(false);
|
|
511
|
+
}
|
|
512
|
+
sendMessage(text) {
|
|
513
|
+
const trimmed = text.trim();
|
|
514
|
+
if (!trimmed)
|
|
515
|
+
return;
|
|
516
|
+
this.messages.update(msgs => [
|
|
517
|
+
...msgs,
|
|
518
|
+
{ sender: 'user', text: trimmed, timestamp: new Date() }
|
|
519
|
+
]);
|
|
520
|
+
this.messageSent.emit(trimmed);
|
|
521
|
+
this.scrollToBottom();
|
|
522
|
+
}
|
|
523
|
+
selectReply(reply) {
|
|
524
|
+
this.sendMessage(reply);
|
|
525
|
+
}
|
|
526
|
+
addAssistantReply(text) {
|
|
527
|
+
this.messages.update(msgs => [
|
|
528
|
+
...msgs,
|
|
529
|
+
{ sender: 'assistant', text, timestamp: new Date() }
|
|
530
|
+
]);
|
|
531
|
+
this.scrollToBottom();
|
|
532
|
+
}
|
|
533
|
+
scrollToBottom() {
|
|
534
|
+
setTimeout(() => {
|
|
535
|
+
if (this.scrollContainer?.nativeElement) {
|
|
536
|
+
this.scrollContainer.nativeElement.scrollTop = this.scrollContainer.nativeElement.scrollHeight;
|
|
537
|
+
}
|
|
538
|
+
}, 50);
|
|
539
|
+
}
|
|
540
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIChatWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
541
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AIChatWidgetComponent, isStandalone: true, selector: "ngx-ai-chat-widget", inputs: { agentName: { classPropertyName: "agentName", publicName: "agentName", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, welcomeMessage: { classPropertyName: "welcomeMessage", publicName: "welcomeMessage", isSignal: true, isRequired: false, transformFunction: null }, quickReplies: { classPropertyName: "quickReplies", publicName: "quickReplies", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { messageSent: "messageSent" }, viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true }], ngImport: i0, template: `
|
|
542
|
+
<!-- Floating Action Button (FAB) -->
|
|
543
|
+
<button
|
|
544
|
+
class="widget-fab"
|
|
545
|
+
[class.active]="isOpen()"
|
|
546
|
+
(click)="toggleOpen()"
|
|
547
|
+
[title]="isOpen() ? 'Close Chat' : 'Open Chat'"
|
|
548
|
+
>
|
|
549
|
+
<span class="fab-icon">{{ isOpen() ? '✕' : icon() }}</span>
|
|
550
|
+
</button>
|
|
551
|
+
|
|
552
|
+
<!-- Chat Overlay Pane -->
|
|
553
|
+
<div class="widget-overlay-pane" [class.open]="isOpen()">
|
|
554
|
+
<!-- Header -->
|
|
555
|
+
<div class="widget-header">
|
|
556
|
+
<div class="header-details">
|
|
557
|
+
<div class="widget-avatar">🤖</div>
|
|
558
|
+
<div>
|
|
559
|
+
<h4 class="widget-title">{{ agentName() }}</h4>
|
|
560
|
+
<span class="widget-status">Online</span>
|
|
561
|
+
</div>
|
|
562
|
+
</div>
|
|
563
|
+
<button class="close-btn" (click)="closeOpen()">✕</button>
|
|
564
|
+
</div>
|
|
565
|
+
|
|
566
|
+
<!-- Feed Body -->
|
|
567
|
+
<div class="widget-body" #scrollContainer>
|
|
568
|
+
@for (msg of messages(); track $index) {
|
|
569
|
+
<div class="message-row" [class.user-row]="msg.sender === 'user'">
|
|
570
|
+
@if (msg.sender === 'assistant') {
|
|
571
|
+
<div class="msg-avatar">🤖</div>
|
|
572
|
+
}
|
|
573
|
+
<div class="msg-bubble" [class.user-bubble]="msg.sender === 'user'">
|
|
574
|
+
<div class="msg-text">{{ msg.text }}</div>
|
|
575
|
+
<div class="msg-time">{{ msg.timestamp | date:'shortTime' }}</div>
|
|
576
|
+
</div>
|
|
577
|
+
</div>
|
|
578
|
+
}
|
|
579
|
+
</div>
|
|
580
|
+
|
|
581
|
+
<!-- Quick Replies -->
|
|
582
|
+
@if (quickReplies().length > 0) {
|
|
583
|
+
<div class="widget-quick-replies">
|
|
584
|
+
@for (reply of quickReplies(); track reply) {
|
|
585
|
+
<button class="reply-pill" (click)="selectReply(reply)">
|
|
586
|
+
{{ reply }}
|
|
587
|
+
</button>
|
|
588
|
+
}
|
|
589
|
+
</div>
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
<!-- Footer Input -->
|
|
593
|
+
<div class="widget-footer">
|
|
594
|
+
<input
|
|
595
|
+
#inputBox
|
|
596
|
+
type="text"
|
|
597
|
+
[placeholder]="placeholder()"
|
|
598
|
+
(keydown.enter)="sendMessage(inputBox.value); inputBox.value = ''"
|
|
599
|
+
class="widget-input"
|
|
600
|
+
/>
|
|
601
|
+
<button
|
|
602
|
+
class="send-btn"
|
|
603
|
+
(click)="sendMessage(inputBox.value); inputBox.value = ''"
|
|
604
|
+
>
|
|
605
|
+
➔
|
|
606
|
+
</button>
|
|
607
|
+
</div>
|
|
608
|
+
</div>
|
|
609
|
+
`, isInline: true, styles: [":host{position:fixed;bottom:24px;right:24px;z-index:9999;font-family:inherit}.widget-fab{width:56px;height:56px;border-radius:50%;border:none;background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;font-size:24px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 16px #4f46e566;transition:all .3s cubic-bezier(.34,1.56,.64,1)}.widget-fab:hover{transform:scale(1.06)}.widget-fab.active{transform:rotate(90deg) scale(.95);background:#0f172a;box-shadow:0 2px 8px #00000026}.fab-icon{line-height:1;display:flex;align-items:center;justify-content:center}.widget-overlay-pane{position:absolute;bottom:72px;right:0;width:360px;height:500px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:16px;box-shadow:0 10px 25px -5px #00000026,0 8px 10px -6px #0000001a;display:flex;flex-direction:column;overflow:hidden;opacity:0;transform:translateY(20px) scale(.95);pointer-events:none;transition:all .28s cubic-bezier(.34,1.56,.64,1);transform-origin:bottom right}.widget-overlay-pane.open{opacity:1;transform:translateY(0) scale(1);pointer-events:auto}.widget-header{padding:14px 16px;background:linear-gradient(135deg,#0f172a,#1e293b);color:#fff;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid rgba(255,255,255,.08)}.header-details{display:flex;align-items:center;gap:10px}.widget-avatar{font-size:20px;background:#ffffff1a;width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center}.widget-title{margin:0;font-size:14px;font-weight:750}.widget-status{font-size:10px;color:#10b981;font-weight:600;display:flex;align-items:center;gap:4px}.widget-status:before{content:\"\";display:inline-block;width:6px;height:6px;border-radius:50%;background:#10b981}.close-btn{background:none;border:none;color:#fff9;font-size:16px;cursor:pointer;padding:4px;transition:color .15s}.close-btn:hover{color:#fff}.widget-body{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px;background:var(--bg-primary, #f8fafc)}.message-row{display:flex;gap:8px;align-items:flex-start;max-width:85%}.message-row.user-row{align-self:flex-end;flex-direction:row-reverse}.msg-avatar{width:28px;height:28px;border-radius:50%;background:#e2e8f0;display:flex;align-items:center;justify-content:center;font-size:14px;flex-shrink:0}.msg-bubble{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);padding:10px 12px;border-radius:2px 12px 12px;box-shadow:var(--shadow-sm)}.message-row.user-row .msg-bubble{background:var(--primary-color, #4f46e5);color:#fff;border:none;border-top-left-radius:12px;border-top-right-radius:2px}.msg-text{font-size:13px;line-height:1.5;word-break:break-word}.msg-time{font-size:9px;color:var(--text-secondary, #64748b);text-align:right;margin-top:4px}.message-row.user-row .msg-time{color:#ffffffb3}.widget-quick-replies{padding:8px 12px;background:var(--bg-primary, #f8fafc);display:flex;gap:6px;overflow-x:auto;border-top:1px solid var(--border-color, #e2e8f0);white-space:nowrap}.widget-quick-replies::-webkit-scrollbar{display:none}.reply-pill{padding:6px 12px;background:var(--bg-secondary, #ffffff);border:1px solid var(--primary-color, #4f46e5);color:var(--primary-color, #4f46e5);border-radius:16px;font-size:11px;font-weight:600;cursor:pointer;transition:all .15s;font-family:inherit}.reply-pill:hover{background:var(--primary-color, #4f46e5);color:#fff}.widget-footer{padding:12px 14px;background:var(--bg-secondary, #ffffff);border-top:1px solid var(--border-color, #e2e8f0);display:flex;gap:8px;align-items:center}.widget-input{flex:1;border:1px solid var(--border-color, #e2e8f0);border-radius:20px;padding:8px 16px;font-size:13px;outline:none;background:var(--bg-primary, #f8fafc);color:var(--text-primary, #0f172a);transition:border-color .15s}.widget-input:focus{border-color:var(--primary-color, #4f46e5)}.send-btn{width:32px;height:32px;border-radius:50%;border:none;background:var(--primary-color, #4f46e5);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:14px;transition:background .15s}.send-btn:hover{background:var(--primary-color-dark, #3730a3)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.DatePipe, name: "date" }] });
|
|
610
|
+
}
|
|
611
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIChatWidgetComponent, decorators: [{
|
|
612
|
+
type: Component,
|
|
613
|
+
args: [{ selector: 'ngx-ai-chat-widget', standalone: true, imports: [CommonModule], template: `
|
|
614
|
+
<!-- Floating Action Button (FAB) -->
|
|
615
|
+
<button
|
|
616
|
+
class="widget-fab"
|
|
617
|
+
[class.active]="isOpen()"
|
|
618
|
+
(click)="toggleOpen()"
|
|
619
|
+
[title]="isOpen() ? 'Close Chat' : 'Open Chat'"
|
|
620
|
+
>
|
|
621
|
+
<span class="fab-icon">{{ isOpen() ? '✕' : icon() }}</span>
|
|
622
|
+
</button>
|
|
623
|
+
|
|
624
|
+
<!-- Chat Overlay Pane -->
|
|
625
|
+
<div class="widget-overlay-pane" [class.open]="isOpen()">
|
|
626
|
+
<!-- Header -->
|
|
627
|
+
<div class="widget-header">
|
|
628
|
+
<div class="header-details">
|
|
629
|
+
<div class="widget-avatar">🤖</div>
|
|
630
|
+
<div>
|
|
631
|
+
<h4 class="widget-title">{{ agentName() }}</h4>
|
|
632
|
+
<span class="widget-status">Online</span>
|
|
633
|
+
</div>
|
|
634
|
+
</div>
|
|
635
|
+
<button class="close-btn" (click)="closeOpen()">✕</button>
|
|
636
|
+
</div>
|
|
637
|
+
|
|
638
|
+
<!-- Feed Body -->
|
|
639
|
+
<div class="widget-body" #scrollContainer>
|
|
640
|
+
@for (msg of messages(); track $index) {
|
|
641
|
+
<div class="message-row" [class.user-row]="msg.sender === 'user'">
|
|
642
|
+
@if (msg.sender === 'assistant') {
|
|
643
|
+
<div class="msg-avatar">🤖</div>
|
|
644
|
+
}
|
|
645
|
+
<div class="msg-bubble" [class.user-bubble]="msg.sender === 'user'">
|
|
646
|
+
<div class="msg-text">{{ msg.text }}</div>
|
|
647
|
+
<div class="msg-time">{{ msg.timestamp | date:'shortTime' }}</div>
|
|
648
|
+
</div>
|
|
649
|
+
</div>
|
|
650
|
+
}
|
|
651
|
+
</div>
|
|
652
|
+
|
|
653
|
+
<!-- Quick Replies -->
|
|
654
|
+
@if (quickReplies().length > 0) {
|
|
655
|
+
<div class="widget-quick-replies">
|
|
656
|
+
@for (reply of quickReplies(); track reply) {
|
|
657
|
+
<button class="reply-pill" (click)="selectReply(reply)">
|
|
658
|
+
{{ reply }}
|
|
659
|
+
</button>
|
|
660
|
+
}
|
|
661
|
+
</div>
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
<!-- Footer Input -->
|
|
665
|
+
<div class="widget-footer">
|
|
666
|
+
<input
|
|
667
|
+
#inputBox
|
|
668
|
+
type="text"
|
|
669
|
+
[placeholder]="placeholder()"
|
|
670
|
+
(keydown.enter)="sendMessage(inputBox.value); inputBox.value = ''"
|
|
671
|
+
class="widget-input"
|
|
672
|
+
/>
|
|
673
|
+
<button
|
|
674
|
+
class="send-btn"
|
|
675
|
+
(click)="sendMessage(inputBox.value); inputBox.value = ''"
|
|
676
|
+
>
|
|
677
|
+
➔
|
|
678
|
+
</button>
|
|
679
|
+
</div>
|
|
680
|
+
</div>
|
|
681
|
+
`, styles: [":host{position:fixed;bottom:24px;right:24px;z-index:9999;font-family:inherit}.widget-fab{width:56px;height:56px;border-radius:50%;border:none;background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;font-size:24px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 16px #4f46e566;transition:all .3s cubic-bezier(.34,1.56,.64,1)}.widget-fab:hover{transform:scale(1.06)}.widget-fab.active{transform:rotate(90deg) scale(.95);background:#0f172a;box-shadow:0 2px 8px #00000026}.fab-icon{line-height:1;display:flex;align-items:center;justify-content:center}.widget-overlay-pane{position:absolute;bottom:72px;right:0;width:360px;height:500px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:16px;box-shadow:0 10px 25px -5px #00000026,0 8px 10px -6px #0000001a;display:flex;flex-direction:column;overflow:hidden;opacity:0;transform:translateY(20px) scale(.95);pointer-events:none;transition:all .28s cubic-bezier(.34,1.56,.64,1);transform-origin:bottom right}.widget-overlay-pane.open{opacity:1;transform:translateY(0) scale(1);pointer-events:auto}.widget-header{padding:14px 16px;background:linear-gradient(135deg,#0f172a,#1e293b);color:#fff;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid rgba(255,255,255,.08)}.header-details{display:flex;align-items:center;gap:10px}.widget-avatar{font-size:20px;background:#ffffff1a;width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center}.widget-title{margin:0;font-size:14px;font-weight:750}.widget-status{font-size:10px;color:#10b981;font-weight:600;display:flex;align-items:center;gap:4px}.widget-status:before{content:\"\";display:inline-block;width:6px;height:6px;border-radius:50%;background:#10b981}.close-btn{background:none;border:none;color:#fff9;font-size:16px;cursor:pointer;padding:4px;transition:color .15s}.close-btn:hover{color:#fff}.widget-body{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px;background:var(--bg-primary, #f8fafc)}.message-row{display:flex;gap:8px;align-items:flex-start;max-width:85%}.message-row.user-row{align-self:flex-end;flex-direction:row-reverse}.msg-avatar{width:28px;height:28px;border-radius:50%;background:#e2e8f0;display:flex;align-items:center;justify-content:center;font-size:14px;flex-shrink:0}.msg-bubble{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);padding:10px 12px;border-radius:2px 12px 12px;box-shadow:var(--shadow-sm)}.message-row.user-row .msg-bubble{background:var(--primary-color, #4f46e5);color:#fff;border:none;border-top-left-radius:12px;border-top-right-radius:2px}.msg-text{font-size:13px;line-height:1.5;word-break:break-word}.msg-time{font-size:9px;color:var(--text-secondary, #64748b);text-align:right;margin-top:4px}.message-row.user-row .msg-time{color:#ffffffb3}.widget-quick-replies{padding:8px 12px;background:var(--bg-primary, #f8fafc);display:flex;gap:6px;overflow-x:auto;border-top:1px solid var(--border-color, #e2e8f0);white-space:nowrap}.widget-quick-replies::-webkit-scrollbar{display:none}.reply-pill{padding:6px 12px;background:var(--bg-secondary, #ffffff);border:1px solid var(--primary-color, #4f46e5);color:var(--primary-color, #4f46e5);border-radius:16px;font-size:11px;font-weight:600;cursor:pointer;transition:all .15s;font-family:inherit}.reply-pill:hover{background:var(--primary-color, #4f46e5);color:#fff}.widget-footer{padding:12px 14px;background:var(--bg-secondary, #ffffff);border-top:1px solid var(--border-color, #e2e8f0);display:flex;gap:8px;align-items:center}.widget-input{flex:1;border:1px solid var(--border-color, #e2e8f0);border-radius:20px;padding:8px 16px;font-size:13px;outline:none;background:var(--bg-primary, #f8fafc);color:var(--text-primary, #0f172a);transition:border-color .15s}.widget-input:focus{border-color:var(--primary-color, #4f46e5)}.send-btn{width:32px;height:32px;border-radius:50%;border:none;background:var(--primary-color, #4f46e5);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:14px;transition:background .15s}.send-btn:hover{background:var(--primary-color-dark, #3730a3)}\n"] }]
|
|
682
|
+
}], propDecorators: { scrollContainer: [{
|
|
683
|
+
type: ViewChild,
|
|
684
|
+
args: ['scrollContainer']
|
|
685
|
+
}] } });
|
|
686
|
+
|
|
687
|
+
class AIPromptEditorComponent {
|
|
688
|
+
// Inputs Binds
|
|
689
|
+
initialTemplate = input('Write a greeting letter to {{user_name}} recommending dynamic integrations for {{product_name}}.');
|
|
690
|
+
initialSystem = input('You are an encouraging and helpful product specialist.');
|
|
691
|
+
// Component Internal State Signals
|
|
692
|
+
systemPrompt = '';
|
|
693
|
+
templateText = signal('');
|
|
694
|
+
temperature = signal(0.7);
|
|
695
|
+
maxTokens = 512;
|
|
696
|
+
varValues = signal({});
|
|
697
|
+
isRunning = signal(false);
|
|
698
|
+
simulatedResponse = signal('');
|
|
699
|
+
constructor() {
|
|
700
|
+
// Populate defaults on initialize
|
|
701
|
+
effect(() => {
|
|
702
|
+
this.templateText.set(this.initialTemplate());
|
|
703
|
+
this.systemPrompt = this.initialSystem();
|
|
704
|
+
}, { allowSignalWrites: true });
|
|
705
|
+
}
|
|
706
|
+
// Parse variables from template string dynamically
|
|
707
|
+
parsedVariables = computed(() => {
|
|
708
|
+
const text = this.templateText();
|
|
709
|
+
const matches = text.match(/\{\{([^}]+)\}\}/g) || [];
|
|
710
|
+
// Deduplicate array values
|
|
711
|
+
const unique = [...new Set(matches.map(m => m.replace(/[{}]/g, '').trim()))];
|
|
712
|
+
return unique;
|
|
713
|
+
});
|
|
714
|
+
// Compiled dynamic prompt preview
|
|
715
|
+
compiledPrompt = computed(() => {
|
|
716
|
+
let t = this.templateText();
|
|
717
|
+
const dict = this.varValues();
|
|
718
|
+
this.parsedVariables().forEach(v => {
|
|
719
|
+
const placeholder = `{{${v}}}`;
|
|
720
|
+
const val = dict[v] || '';
|
|
721
|
+
t = t.split(placeholder).join(val);
|
|
722
|
+
});
|
|
723
|
+
return t;
|
|
724
|
+
});
|
|
725
|
+
onTemplateChange(text) {
|
|
726
|
+
this.templateText.set(text);
|
|
727
|
+
}
|
|
728
|
+
onTempChange(event) {
|
|
729
|
+
const val = event.target.value;
|
|
730
|
+
this.temperature.set(Number(val));
|
|
731
|
+
}
|
|
732
|
+
getVarValue(vName) {
|
|
733
|
+
// Default initial values to make playground look populated
|
|
734
|
+
const values = this.varValues();
|
|
735
|
+
if (values[vName] !== undefined)
|
|
736
|
+
return values[vName];
|
|
737
|
+
// Set typical defaults
|
|
738
|
+
if (vName === 'user_name')
|
|
739
|
+
return 'John Doe';
|
|
740
|
+
if (vName === 'product_name')
|
|
741
|
+
return 'ngx-core-components';
|
|
742
|
+
return '';
|
|
743
|
+
}
|
|
744
|
+
setVarValue(vName, event) {
|
|
745
|
+
const val = event.target.value;
|
|
746
|
+
this.varValues.update(dict => ({ ...dict, [vName]: val }));
|
|
747
|
+
}
|
|
748
|
+
triggerRun() {
|
|
749
|
+
if (this.isRunning())
|
|
750
|
+
return;
|
|
751
|
+
this.isRunning.set(true);
|
|
752
|
+
this.simulatedResponse.set('');
|
|
753
|
+
// Simulate Streaming response output
|
|
754
|
+
setTimeout(() => {
|
|
755
|
+
this.isRunning.set(false);
|
|
756
|
+
const name = this.varValues()['user_name'] || 'John Doe';
|
|
757
|
+
const prod = this.varValues()['product_name'] || 'ngx-core-components';
|
|
758
|
+
this.simulatedResponse.set(`Dear ${name},\n\n` +
|
|
759
|
+
`Thank you for exploring ${prod}! We are thrilled to assist you. ` +
|
|
760
|
+
`Implementing our modular Angular components will instantly modernize your user interface and ensure 100% signal-driven reactive state transitions.\n\n` +
|
|
761
|
+
`Best regards,\n` +
|
|
762
|
+
`The Product Specialist Team`);
|
|
763
|
+
}, 1800);
|
|
764
|
+
}
|
|
765
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIPromptEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
766
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AIPromptEditorComponent, isStandalone: true, selector: "ngx-ai-prompt-editor", inputs: { initialTemplate: { classPropertyName: "initialTemplate", publicName: "initialTemplate", isSignal: true, isRequired: false, transformFunction: null }, initialSystem: { classPropertyName: "initialSystem", publicName: "initialSystem", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
767
|
+
<div class="prompt-studio-wrapper">
|
|
768
|
+
<div class="prompt-studio-grid">
|
|
769
|
+
|
|
770
|
+
<!-- Left Panel: Prompt Configuration -->
|
|
771
|
+
<div class="studio-config-card">
|
|
772
|
+
<div class="card-header">
|
|
773
|
+
<h3>Prompt Engineering Studio</h3>
|
|
774
|
+
<p>Design instructions, parse template variables, and adjust parameters.</p>
|
|
775
|
+
</div>
|
|
776
|
+
|
|
777
|
+
<div class="config-body">
|
|
778
|
+
<!-- System Instructions -->
|
|
779
|
+
<div class="form-group">
|
|
780
|
+
<label class="group-label">System Instructions</label>
|
|
781
|
+
<textarea
|
|
782
|
+
class="studio-textarea"
|
|
783
|
+
rows="3"
|
|
784
|
+
[(ngModel)]="systemPrompt"
|
|
785
|
+
placeholder="You are a helpful and precise assistant..."
|
|
786
|
+
></textarea>
|
|
787
|
+
</div>
|
|
788
|
+
|
|
789
|
+
<!-- Prompt Template -->
|
|
790
|
+
<div class="form-group">
|
|
791
|
+
<label class="group-label">Prompt Template</label>
|
|
792
|
+
<div class="help-text">Use double braces <code>{{ '{' }}{{ '{' }}variable{{ '}' }}{{ '}' }}</code> to define dynamic parameters.</div>
|
|
793
|
+
<textarea
|
|
794
|
+
class="studio-textarea template-textarea"
|
|
795
|
+
rows="6"
|
|
796
|
+
[ngModel]="templateText()"
|
|
797
|
+
(ngModelChange)="onTemplateChange($event)"
|
|
798
|
+
placeholder="Write your template here..."
|
|
799
|
+
></textarea>
|
|
800
|
+
</div>
|
|
801
|
+
|
|
802
|
+
<!-- Parameters Grid -->
|
|
803
|
+
<div class="parameters-grid">
|
|
804
|
+
<div class="form-group">
|
|
805
|
+
<label class="group-label">Temperature: {{ temperature() }}</label>
|
|
806
|
+
<input
|
|
807
|
+
type="range"
|
|
808
|
+
min="0"
|
|
809
|
+
max="1"
|
|
810
|
+
step="0.05"
|
|
811
|
+
[ngModel]="temperature()"
|
|
812
|
+
(input)="onTempChange($event)"
|
|
813
|
+
class="studio-slider"
|
|
814
|
+
/>
|
|
815
|
+
</div>
|
|
816
|
+
|
|
817
|
+
<div class="form-group">
|
|
818
|
+
<label class="group-label">Max Output Tokens</label>
|
|
819
|
+
<input
|
|
820
|
+
type="number"
|
|
821
|
+
[(ngModel)]="maxTokens"
|
|
822
|
+
class="studio-input"
|
|
823
|
+
min="1"
|
|
824
|
+
max="4096"
|
|
825
|
+
/>
|
|
826
|
+
</div>
|
|
827
|
+
</div>
|
|
828
|
+
|
|
829
|
+
<!-- Dynamic Variables -->
|
|
830
|
+
@if (parsedVariables().length > 0) {
|
|
831
|
+
<div class="form-group variables-section">
|
|
832
|
+
<label class="group-label">Parsed Template Variables</label>
|
|
833
|
+
<div class="variables-grid">
|
|
834
|
+
@for (v of parsedVariables(); track v) {
|
|
835
|
+
<div class="var-row">
|
|
836
|
+
<span class="var-name">{{ v }}</span>
|
|
837
|
+
<input
|
|
838
|
+
type="text"
|
|
839
|
+
[value]="getVarValue(v)"
|
|
840
|
+
(input)="setVarValue(v, $event)"
|
|
841
|
+
class="studio-input var-input"
|
|
842
|
+
[placeholder]="'Value for ' + v"
|
|
843
|
+
/>
|
|
844
|
+
</div>
|
|
845
|
+
}
|
|
846
|
+
</div>
|
|
847
|
+
</div>
|
|
848
|
+
}
|
|
849
|
+
</div>
|
|
850
|
+
</div>
|
|
851
|
+
|
|
852
|
+
<!-- Right Panel: Live Compiler & Simulator -->
|
|
853
|
+
<div class="studio-output-card">
|
|
854
|
+
<div class="card-header">
|
|
855
|
+
<h3>Live Preview & Test</h3>
|
|
856
|
+
<p>Inspect compiled prompt outputs and trigger mock run generations.</p>
|
|
857
|
+
</div>
|
|
858
|
+
|
|
859
|
+
<div class="output-body">
|
|
860
|
+
<!-- Compiled Output Box -->
|
|
861
|
+
<div class="preview-group">
|
|
862
|
+
<label class="group-label">Compiled Prompt Preview</label>
|
|
863
|
+
<div class="prompt-preview-box">
|
|
864
|
+
@if (compiledPrompt()) {
|
|
865
|
+
<p class="compiled-text">{{ compiledPrompt() }}</p>
|
|
866
|
+
} @else {
|
|
867
|
+
<span class="empty-text">Write a template to preview compiled text...</span>
|
|
868
|
+
}
|
|
869
|
+
</div>
|
|
870
|
+
</div>
|
|
871
|
+
|
|
872
|
+
<!-- Run Control -->
|
|
873
|
+
<div class="run-control-row">
|
|
874
|
+
<button
|
|
875
|
+
class="run-btn"
|
|
876
|
+
[disabled]="isRunning()"
|
|
877
|
+
(click)="triggerRun()"
|
|
878
|
+
>
|
|
879
|
+
{{ isRunning() ? 'Generating Response...' : '⚡ Run Simulation' }}
|
|
880
|
+
</button>
|
|
881
|
+
</div>
|
|
882
|
+
|
|
883
|
+
<!-- Simulated Output Response -->
|
|
884
|
+
<div class="preview-group flex-fill">
|
|
885
|
+
<label class="group-label">Simulated AI Response</label>
|
|
886
|
+
<div class="simulation-response-box" [class.loading]="isRunning()">
|
|
887
|
+
@if (isRunning()) {
|
|
888
|
+
<div class="pulse-loader">
|
|
889
|
+
<span></span><span></span><span></span>
|
|
890
|
+
</div>
|
|
891
|
+
} @else if (simulatedResponse()) {
|
|
892
|
+
<div class="response-text">{{ simulatedResponse() }}</div>
|
|
893
|
+
} @else {
|
|
894
|
+
<span class="empty-text">Click Run Simulation to generate a mock response.</span>
|
|
895
|
+
}
|
|
896
|
+
</div>
|
|
897
|
+
</div>
|
|
898
|
+
</div>
|
|
899
|
+
</div>
|
|
900
|
+
|
|
901
|
+
</div>
|
|
902
|
+
</div>
|
|
903
|
+
`, isInline: true, styles: [".prompt-studio-wrapper{width:100%;height:100%;padding:4px;font-family:inherit}.prompt-studio-grid{display:grid;grid-template-columns:1.2fr 1fr;gap:24px;align-items:stretch}@media (max-width: 960px){.prompt-studio-grid{grid-template-columns:1fr}}.studio-config-card,.studio-output-card{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm);display:flex;flex-direction:column;overflow:hidden}.card-header{padding:16px 20px;border-bottom:1px solid var(--border-color, #e2e8f0)}.card-header h3{margin:0 0 4px;font-size:16px;font-weight:800;color:var(--text-primary, #0f172a)}.card-header p{margin:0;font-size:12px;color:var(--text-secondary, #64748b)}.config-body,.output-body{padding:20px;display:flex;flex-direction:column;gap:16px;flex:1}.flex-fill{flex:1;display:flex;flex-direction:column}.form-group{display:flex;flex-direction:column;gap:6px}.group-label{font-size:11px;font-weight:750;text-transform:uppercase;letter-spacing:.5px;color:var(--text-secondary, #64748b)}.help-text{font-size:11px;color:var(--text-secondary, #64748b);margin-bottom:2px}.help-text code{background:var(--border-light, #f1f5f9);padding:1px 4px;border-radius:3px;font-family:monospace;font-weight:700}.studio-textarea{width:100%;border:1px solid var(--border-color, #e2e8f0);border-radius:8px;padding:10px 12px;font-size:13px;outline:none;background:var(--bg-primary, #f8fafc);color:var(--text-primary, #0f172a);font-family:inherit;resize:vertical;transition:border-color .15s}.template-textarea{font-family:Cascadia Code,Consolas,Monaco,monospace;font-size:12px}.studio-textarea:focus,.studio-input:focus{border-color:var(--primary-color, #4f46e5)}.studio-input{border:1px solid var(--border-color, #e2e8f0);border-radius:8px;padding:8px 12px;font-size:13px;background:var(--bg-primary, #f8fafc);color:var(--text-primary, #0f172a);outline:none;transition:border-color .15s;font-family:inherit}.parameters-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.studio-slider{width:100%;cursor:pointer;accent-color:var(--primary-color, #4f46e5);margin-top:6px}.variables-section{border-top:1px dashed var(--border-color, #e2e8f0);padding-top:16px;margin-top:8px}.variables-grid{display:flex;flex-direction:column;gap:10px;margin-top:6px}.var-row{display:grid;grid-template-columns:100px 1fr;align-items:center;gap:12px}.var-name{font-family:monospace;font-size:12px;font-weight:700;color:var(--primary-color, #4f46e5);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.var-input{padding:6px 12px}.preview-group{display:flex;flex-direction:column;gap:6px}.prompt-preview-box,.simulation-response-box{border:1px solid var(--border-color, #e2e8f0);border-radius:8px;padding:12px 14px;background:var(--bg-primary, #f8fafc);min-height:80px;max-height:180px;overflow-y:auto;font-size:13px;line-height:1.5}.prompt-preview-box{font-family:monospace;font-size:12px;color:var(--text-primary, #0f172a)}.simulation-response-box{flex:1;display:flex;align-items:flex-start}.simulation-response-box.loading{align-items:center;justify-content:center}.empty-text{color:var(--text-secondary, #64748b);font-style:italic}.compiled-text,.response-text{margin:0;white-space:pre-wrap}.run-control-row{display:flex;justify-content:flex-end}.run-btn{background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;border:none;padding:10px 20px;border-radius:8px;font-size:13px;font-weight:700;cursor:pointer;box-shadow:0 4px 12px #4f46e540;transition:all .2s;font-family:inherit}.run-btn:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 6px 16px #4f46e559}.run-btn:disabled{opacity:.6;cursor:not-allowed}.pulse-loader{display:flex;gap:6px}.pulse-loader span{width:8px;height:8px;background:var(--primary-color, #4f46e5);border-radius:50%;animation:bounce 1.4s infinite ease-in-out both}.pulse-loader span:nth-child(1){animation-delay:-.32s}.pulse-loader span:nth-child(2){animation-delay:-.16s}@keyframes bounce{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.RangeValueAccessor, selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i2.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
904
|
+
}
|
|
905
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIPromptEditorComponent, decorators: [{
|
|
906
|
+
type: Component,
|
|
907
|
+
args: [{ selector: 'ngx-ai-prompt-editor', standalone: true, imports: [CommonModule, FormsModule], template: `
|
|
908
|
+
<div class="prompt-studio-wrapper">
|
|
909
|
+
<div class="prompt-studio-grid">
|
|
910
|
+
|
|
911
|
+
<!-- Left Panel: Prompt Configuration -->
|
|
912
|
+
<div class="studio-config-card">
|
|
913
|
+
<div class="card-header">
|
|
914
|
+
<h3>Prompt Engineering Studio</h3>
|
|
915
|
+
<p>Design instructions, parse template variables, and adjust parameters.</p>
|
|
916
|
+
</div>
|
|
917
|
+
|
|
918
|
+
<div class="config-body">
|
|
919
|
+
<!-- System Instructions -->
|
|
920
|
+
<div class="form-group">
|
|
921
|
+
<label class="group-label">System Instructions</label>
|
|
922
|
+
<textarea
|
|
923
|
+
class="studio-textarea"
|
|
924
|
+
rows="3"
|
|
925
|
+
[(ngModel)]="systemPrompt"
|
|
926
|
+
placeholder="You are a helpful and precise assistant..."
|
|
927
|
+
></textarea>
|
|
928
|
+
</div>
|
|
929
|
+
|
|
930
|
+
<!-- Prompt Template -->
|
|
931
|
+
<div class="form-group">
|
|
932
|
+
<label class="group-label">Prompt Template</label>
|
|
933
|
+
<div class="help-text">Use double braces <code>{{ '{' }}{{ '{' }}variable{{ '}' }}{{ '}' }}</code> to define dynamic parameters.</div>
|
|
934
|
+
<textarea
|
|
935
|
+
class="studio-textarea template-textarea"
|
|
936
|
+
rows="6"
|
|
937
|
+
[ngModel]="templateText()"
|
|
938
|
+
(ngModelChange)="onTemplateChange($event)"
|
|
939
|
+
placeholder="Write your template here..."
|
|
940
|
+
></textarea>
|
|
941
|
+
</div>
|
|
942
|
+
|
|
943
|
+
<!-- Parameters Grid -->
|
|
944
|
+
<div class="parameters-grid">
|
|
945
|
+
<div class="form-group">
|
|
946
|
+
<label class="group-label">Temperature: {{ temperature() }}</label>
|
|
947
|
+
<input
|
|
948
|
+
type="range"
|
|
949
|
+
min="0"
|
|
950
|
+
max="1"
|
|
951
|
+
step="0.05"
|
|
952
|
+
[ngModel]="temperature()"
|
|
953
|
+
(input)="onTempChange($event)"
|
|
954
|
+
class="studio-slider"
|
|
955
|
+
/>
|
|
956
|
+
</div>
|
|
957
|
+
|
|
958
|
+
<div class="form-group">
|
|
959
|
+
<label class="group-label">Max Output Tokens</label>
|
|
960
|
+
<input
|
|
961
|
+
type="number"
|
|
962
|
+
[(ngModel)]="maxTokens"
|
|
963
|
+
class="studio-input"
|
|
964
|
+
min="1"
|
|
965
|
+
max="4096"
|
|
966
|
+
/>
|
|
967
|
+
</div>
|
|
968
|
+
</div>
|
|
969
|
+
|
|
970
|
+
<!-- Dynamic Variables -->
|
|
971
|
+
@if (parsedVariables().length > 0) {
|
|
972
|
+
<div class="form-group variables-section">
|
|
973
|
+
<label class="group-label">Parsed Template Variables</label>
|
|
974
|
+
<div class="variables-grid">
|
|
975
|
+
@for (v of parsedVariables(); track v) {
|
|
976
|
+
<div class="var-row">
|
|
977
|
+
<span class="var-name">{{ v }}</span>
|
|
978
|
+
<input
|
|
979
|
+
type="text"
|
|
980
|
+
[value]="getVarValue(v)"
|
|
981
|
+
(input)="setVarValue(v, $event)"
|
|
982
|
+
class="studio-input var-input"
|
|
983
|
+
[placeholder]="'Value for ' + v"
|
|
984
|
+
/>
|
|
985
|
+
</div>
|
|
986
|
+
}
|
|
987
|
+
</div>
|
|
988
|
+
</div>
|
|
989
|
+
}
|
|
990
|
+
</div>
|
|
991
|
+
</div>
|
|
992
|
+
|
|
993
|
+
<!-- Right Panel: Live Compiler & Simulator -->
|
|
994
|
+
<div class="studio-output-card">
|
|
995
|
+
<div class="card-header">
|
|
996
|
+
<h3>Live Preview & Test</h3>
|
|
997
|
+
<p>Inspect compiled prompt outputs and trigger mock run generations.</p>
|
|
998
|
+
</div>
|
|
999
|
+
|
|
1000
|
+
<div class="output-body">
|
|
1001
|
+
<!-- Compiled Output Box -->
|
|
1002
|
+
<div class="preview-group">
|
|
1003
|
+
<label class="group-label">Compiled Prompt Preview</label>
|
|
1004
|
+
<div class="prompt-preview-box">
|
|
1005
|
+
@if (compiledPrompt()) {
|
|
1006
|
+
<p class="compiled-text">{{ compiledPrompt() }}</p>
|
|
1007
|
+
} @else {
|
|
1008
|
+
<span class="empty-text">Write a template to preview compiled text...</span>
|
|
1009
|
+
}
|
|
1010
|
+
</div>
|
|
1011
|
+
</div>
|
|
1012
|
+
|
|
1013
|
+
<!-- Run Control -->
|
|
1014
|
+
<div class="run-control-row">
|
|
1015
|
+
<button
|
|
1016
|
+
class="run-btn"
|
|
1017
|
+
[disabled]="isRunning()"
|
|
1018
|
+
(click)="triggerRun()"
|
|
1019
|
+
>
|
|
1020
|
+
{{ isRunning() ? 'Generating Response...' : '⚡ Run Simulation' }}
|
|
1021
|
+
</button>
|
|
1022
|
+
</div>
|
|
1023
|
+
|
|
1024
|
+
<!-- Simulated Output Response -->
|
|
1025
|
+
<div class="preview-group flex-fill">
|
|
1026
|
+
<label class="group-label">Simulated AI Response</label>
|
|
1027
|
+
<div class="simulation-response-box" [class.loading]="isRunning()">
|
|
1028
|
+
@if (isRunning()) {
|
|
1029
|
+
<div class="pulse-loader">
|
|
1030
|
+
<span></span><span></span><span></span>
|
|
1031
|
+
</div>
|
|
1032
|
+
} @else if (simulatedResponse()) {
|
|
1033
|
+
<div class="response-text">{{ simulatedResponse() }}</div>
|
|
1034
|
+
} @else {
|
|
1035
|
+
<span class="empty-text">Click Run Simulation to generate a mock response.</span>
|
|
1036
|
+
}
|
|
1037
|
+
</div>
|
|
1038
|
+
</div>
|
|
1039
|
+
</div>
|
|
1040
|
+
</div>
|
|
1041
|
+
|
|
1042
|
+
</div>
|
|
1043
|
+
</div>
|
|
1044
|
+
`, styles: [".prompt-studio-wrapper{width:100%;height:100%;padding:4px;font-family:inherit}.prompt-studio-grid{display:grid;grid-template-columns:1.2fr 1fr;gap:24px;align-items:stretch}@media (max-width: 960px){.prompt-studio-grid{grid-template-columns:1fr}}.studio-config-card,.studio-output-card{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm);display:flex;flex-direction:column;overflow:hidden}.card-header{padding:16px 20px;border-bottom:1px solid var(--border-color, #e2e8f0)}.card-header h3{margin:0 0 4px;font-size:16px;font-weight:800;color:var(--text-primary, #0f172a)}.card-header p{margin:0;font-size:12px;color:var(--text-secondary, #64748b)}.config-body,.output-body{padding:20px;display:flex;flex-direction:column;gap:16px;flex:1}.flex-fill{flex:1;display:flex;flex-direction:column}.form-group{display:flex;flex-direction:column;gap:6px}.group-label{font-size:11px;font-weight:750;text-transform:uppercase;letter-spacing:.5px;color:var(--text-secondary, #64748b)}.help-text{font-size:11px;color:var(--text-secondary, #64748b);margin-bottom:2px}.help-text code{background:var(--border-light, #f1f5f9);padding:1px 4px;border-radius:3px;font-family:monospace;font-weight:700}.studio-textarea{width:100%;border:1px solid var(--border-color, #e2e8f0);border-radius:8px;padding:10px 12px;font-size:13px;outline:none;background:var(--bg-primary, #f8fafc);color:var(--text-primary, #0f172a);font-family:inherit;resize:vertical;transition:border-color .15s}.template-textarea{font-family:Cascadia Code,Consolas,Monaco,monospace;font-size:12px}.studio-textarea:focus,.studio-input:focus{border-color:var(--primary-color, #4f46e5)}.studio-input{border:1px solid var(--border-color, #e2e8f0);border-radius:8px;padding:8px 12px;font-size:13px;background:var(--bg-primary, #f8fafc);color:var(--text-primary, #0f172a);outline:none;transition:border-color .15s;font-family:inherit}.parameters-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.studio-slider{width:100%;cursor:pointer;accent-color:var(--primary-color, #4f46e5);margin-top:6px}.variables-section{border-top:1px dashed var(--border-color, #e2e8f0);padding-top:16px;margin-top:8px}.variables-grid{display:flex;flex-direction:column;gap:10px;margin-top:6px}.var-row{display:grid;grid-template-columns:100px 1fr;align-items:center;gap:12px}.var-name{font-family:monospace;font-size:12px;font-weight:700;color:var(--primary-color, #4f46e5);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.var-input{padding:6px 12px}.preview-group{display:flex;flex-direction:column;gap:6px}.prompt-preview-box,.simulation-response-box{border:1px solid var(--border-color, #e2e8f0);border-radius:8px;padding:12px 14px;background:var(--bg-primary, #f8fafc);min-height:80px;max-height:180px;overflow-y:auto;font-size:13px;line-height:1.5}.prompt-preview-box{font-family:monospace;font-size:12px;color:var(--text-primary, #0f172a)}.simulation-response-box{flex:1;display:flex;align-items:flex-start}.simulation-response-box.loading{align-items:center;justify-content:center}.empty-text{color:var(--text-secondary, #64748b);font-style:italic}.compiled-text,.response-text{margin:0;white-space:pre-wrap}.run-control-row{display:flex;justify-content:flex-end}.run-btn{background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;border:none;padding:10px 20px;border-radius:8px;font-size:13px;font-weight:700;cursor:pointer;box-shadow:0 4px 12px #4f46e540;transition:all .2s;font-family:inherit}.run-btn:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 6px 16px #4f46e559}.run-btn:disabled{opacity:.6;cursor:not-allowed}.pulse-loader{display:flex;gap:6px}.pulse-loader span{width:8px;height:8px;background:var(--primary-color, #4f46e5);border-radius:50%;animation:bounce 1.4s infinite ease-in-out both}.pulse-loader span:nth-child(1){animation-delay:-.32s}.pulse-loader span:nth-child(2){animation-delay:-.16s}@keyframes bounce{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}\n"] }]
|
|
1045
|
+
}], ctorParameters: () => [] });
|
|
1046
|
+
|
|
1047
|
+
class AICodeEditorComponent {
|
|
1048
|
+
// Inputs
|
|
1049
|
+
code = input('');
|
|
1050
|
+
suggestion = input('');
|
|
1051
|
+
language = input('typescript');
|
|
1052
|
+
theme = input('light');
|
|
1053
|
+
disabled = input(false);
|
|
1054
|
+
explanation = input('');
|
|
1055
|
+
// Outputs
|
|
1056
|
+
codeChange = output();
|
|
1057
|
+
acceptSuggestion = output();
|
|
1058
|
+
declineSuggestion = output();
|
|
1059
|
+
regenerate = output();
|
|
1060
|
+
// State
|
|
1061
|
+
isFocused = signal(false);
|
|
1062
|
+
suggestionAccepted = signal(false);
|
|
1063
|
+
showExplanation = signal(false);
|
|
1064
|
+
copyText = signal('Copy');
|
|
1065
|
+
copyTooltip = signal('Copy code to clipboard');
|
|
1066
|
+
// Lines computed property for line numbers
|
|
1067
|
+
lines = () => {
|
|
1068
|
+
const rawCode = this.code() || '';
|
|
1069
|
+
return rawCode.split('\n');
|
|
1070
|
+
};
|
|
1071
|
+
editorInput;
|
|
1072
|
+
focusTextarea() {
|
|
1073
|
+
if (this.disabled())
|
|
1074
|
+
return;
|
|
1075
|
+
if (this.editorInput && this.editorInput.nativeElement) {
|
|
1076
|
+
this.editorInput.nativeElement.focus();
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
onCodeChange(newVal) {
|
|
1080
|
+
this.codeChange.emit(newVal);
|
|
1081
|
+
// If the suggestion is pending and user edits, we reset the acceptance signal
|
|
1082
|
+
if (this.suggestionAccepted()) {
|
|
1083
|
+
this.suggestionAccepted.set(false);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
handleKeydown(event) {
|
|
1087
|
+
if (this.disabled())
|
|
1088
|
+
return;
|
|
1089
|
+
// Tab accepts suggestion if available
|
|
1090
|
+
if (event.key === 'Tab' && this.suggestion() && !this.suggestionAccepted()) {
|
|
1091
|
+
event.preventDefault();
|
|
1092
|
+
this.accept();
|
|
1093
|
+
}
|
|
1094
|
+
// Esc declines suggestion if available
|
|
1095
|
+
if (event.key === 'Escape' && this.suggestion() && !this.suggestionAccepted()) {
|
|
1096
|
+
event.preventDefault();
|
|
1097
|
+
this.decline();
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
accept() {
|
|
1101
|
+
this.suggestionAccepted.set(true);
|
|
1102
|
+
const fullCode = this.code() + this.suggestion();
|
|
1103
|
+
this.codeChange.emit(fullCode);
|
|
1104
|
+
this.acceptSuggestion.emit();
|
|
1105
|
+
}
|
|
1106
|
+
decline() {
|
|
1107
|
+
this.declineSuggestion.emit();
|
|
1108
|
+
}
|
|
1109
|
+
triggerRegenerate() {
|
|
1110
|
+
this.suggestionAccepted.set(false);
|
|
1111
|
+
this.showExplanation.set(false);
|
|
1112
|
+
this.regenerate.emit();
|
|
1113
|
+
}
|
|
1114
|
+
explainSuggestedCode() {
|
|
1115
|
+
this.showExplanation.set(true);
|
|
1116
|
+
}
|
|
1117
|
+
copyCode() {
|
|
1118
|
+
const combined = this.code() + (this.suggestionAccepted() ? '' : this.suggestion());
|
|
1119
|
+
navigator.clipboard.writeText(combined).then(() => {
|
|
1120
|
+
this.copyText.set('Copied!');
|
|
1121
|
+
setTimeout(() => this.copyText.set('Copy'), 2000);
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AICodeEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1125
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AICodeEditorComponent, isStandalone: true, selector: "ngx-ai-code-editor", inputs: { code: { classPropertyName: "code", publicName: "code", isSignal: true, isRequired: false, transformFunction: null }, suggestion: { classPropertyName: "suggestion", publicName: "suggestion", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, explanation: { classPropertyName: "explanation", publicName: "explanation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { codeChange: "codeChange", acceptSuggestion: "acceptSuggestion", declineSuggestion: "declineSuggestion", regenerate: "regenerate" }, viewQueries: [{ propertyName: "editorInput", first: true, predicate: ["editorInput"], descendants: true }], ngImport: i0, template: `
|
|
1126
|
+
<div class="code-editor-wrapper" [class.dark]="theme() === 'dark'" [class.focused]="isFocused()">
|
|
1127
|
+
<!-- Toolbar Header -->
|
|
1128
|
+
<div class="editor-header">
|
|
1129
|
+
<div class="header-left">
|
|
1130
|
+
<span class="editor-dot red"></span>
|
|
1131
|
+
<span class="editor-dot yellow"></span>
|
|
1132
|
+
<span class="editor-dot green"></span>
|
|
1133
|
+
<span class="editor-lang-badge">{{ language() | uppercase }}</span>
|
|
1134
|
+
</div>
|
|
1135
|
+
<div class="header-right">
|
|
1136
|
+
<span class="ai-pill">✨ AI Suggestion Active</span>
|
|
1137
|
+
<button class="icon-btn" (click)="copyCode()" [title]="copyTooltip()">
|
|
1138
|
+
{{ copyText() }}
|
|
1139
|
+
</button>
|
|
1140
|
+
</div>
|
|
1141
|
+
</div>
|
|
1142
|
+
|
|
1143
|
+
<!-- Editor Canvas -->
|
|
1144
|
+
<div class="editor-canvas" (click)="focusTextarea()">
|
|
1145
|
+
<!-- Line Numbers -->
|
|
1146
|
+
<div class="line-numbers">
|
|
1147
|
+
@for (line of lines(); track $index) {
|
|
1148
|
+
<div class="line-num">{{ $index + 1 }}</div>
|
|
1149
|
+
}
|
|
1150
|
+
</div>
|
|
1151
|
+
|
|
1152
|
+
<!-- Code Content Area -->
|
|
1153
|
+
<div class="code-content-container">
|
|
1154
|
+
<textarea
|
|
1155
|
+
#editorInput
|
|
1156
|
+
class="hidden-textarea"
|
|
1157
|
+
[ngModel]="code()"
|
|
1158
|
+
(ngModelChange)="onCodeChange($event)"
|
|
1159
|
+
(focus)="isFocused.set(true)"
|
|
1160
|
+
(blur)="isFocused.set(false)"
|
|
1161
|
+
(keydown)="handleKeydown($event)"
|
|
1162
|
+
[disabled]="disabled()"
|
|
1163
|
+
></textarea>
|
|
1164
|
+
|
|
1165
|
+
<!-- Rendered Code Grid with Ghost Text -->
|
|
1166
|
+
<pre class="rendered-code"><code>{{ code() }}<span class="cursor-pipe" *ngIf="isFocused()">|</span><span
|
|
1167
|
+
*ngIf="suggestion() && !suggestionAccepted()"
|
|
1168
|
+
class="ghost-text"
|
|
1169
|
+
>{{ suggestion() }}</span></code></pre>
|
|
1170
|
+
</div>
|
|
1171
|
+
</div>
|
|
1172
|
+
|
|
1173
|
+
<!-- Suggestion Panel Controls -->
|
|
1174
|
+
<div class="editor-footer" *ngIf="suggestion() && !suggestionAccepted()">
|
|
1175
|
+
<div class="suggestion-info">
|
|
1176
|
+
<span class="sparkle">✨</span>
|
|
1177
|
+
<span class="desc">Press <kbd class="editor-kbd">Tab</kbd> to accept suggestion, or <kbd class="editor-kbd">Esc</kbd> to dismiss.</span>
|
|
1178
|
+
</div>
|
|
1179
|
+
<div class="action-buttons">
|
|
1180
|
+
<button class="footer-btn reject-btn" (click)="decline()">Decline (Esc)</button>
|
|
1181
|
+
<button class="footer-btn accept-btn" (click)="accept()">Accept (Tab)</button>
|
|
1182
|
+
</div>
|
|
1183
|
+
</div>
|
|
1184
|
+
|
|
1185
|
+
<!-- Explanation Panel -->
|
|
1186
|
+
<div class="explanation-panel" *ngIf="explanation() && showExplanation()">
|
|
1187
|
+
<div class="explanation-header">
|
|
1188
|
+
<span class="sparkle">💡 AI Explanation</span>
|
|
1189
|
+
<button class="close-explanation-btn" (click)="showExplanation.set(false)">✕</button>
|
|
1190
|
+
</div>
|
|
1191
|
+
<div class="explanation-body">
|
|
1192
|
+
{{ explanation() }}
|
|
1193
|
+
</div>
|
|
1194
|
+
</div>
|
|
1195
|
+
|
|
1196
|
+
<!-- Secondary Panel Controls (when suggestion is accepted or inactive) -->
|
|
1197
|
+
<div class="editor-footer justify-end" *ngIf="!suggestion() || suggestionAccepted()">
|
|
1198
|
+
<div class="action-buttons">
|
|
1199
|
+
<button class="footer-btn secondary-btn" (click)="explainSuggestedCode()">Explain Code</button>
|
|
1200
|
+
<button class="footer-btn primary-btn" (click)="triggerRegenerate()">Re-generate Suggestion</button>
|
|
1201
|
+
</div>
|
|
1202
|
+
</div>
|
|
1203
|
+
</div>
|
|
1204
|
+
`, isInline: true, styles: [":host{display:block;width:100%;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace}.code-editor-wrapper{border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);background:var(--bg-secondary, #ffffff);box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));overflow:hidden;display:flex;flex-direction:column;transition:all .25s cubic-bezier(.4,0,.2,1)}.code-editor-wrapper.focused{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.editor-header{display:flex;justify-content:space-between;align-items:center;padding:10px 16px;background:var(--border-light, #f1f5f9);border-bottom:1px solid var(--border-color, #e2e8f0)}.header-left{display:flex;align-items:center;gap:6px}.editor-dot{width:10px;height:10px;border-radius:50%}.editor-dot.red{background:#ef4444}.editor-dot.yellow{background:#f59e0b}.editor-dot.green{background:#10b981}.editor-lang-badge{margin-left:10px;font-size:11px;font-weight:700;color:var(--text-secondary, #475569);background:#0000000d;padding:2px 6px;border-radius:4px;letter-spacing:.5px}.header-right{display:flex;align-items:center;gap:12px}.ai-pill{font-size:11px;font-weight:600;background:linear-gradient(135deg,#4f46e51a,#7c3aed1a);color:#6d28d9;padding:2px 8px;border-radius:9999px;border:1px solid rgba(124,58,237,.2)}.icon-btn{background:transparent;border:none;color:var(--text-secondary, #475569);cursor:pointer;font-size:11px;padding:4px 8px;border-radius:4px;transition:background .2s}.icon-btn:hover{background:#0000000d;color:var(--text-primary, #0f172a)}.editor-canvas{display:flex;flex-direction:row;position:relative;min-height:150px;background:var(--bg-secondary, #ffffff);cursor:text}.line-numbers{padding:16px 8px 16px 12px;border-right:1px solid var(--border-color, #e2e8f0);background:#00000003;-webkit-user-select:none;user-select:none;text-align:right;min-width:40px}.line-num{color:var(--text-muted, #94a3b8);font-size:12px;line-height:1.6;height:19.2px}.code-content-container{position:relative;flex:1;overflow:hidden}.hidden-textarea{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;z-index:2;resize:none;border:none;outline:none;padding:16px;font-family:inherit;font-size:13px;line-height:1.6;white-space:pre-wrap;word-wrap:break-word}.rendered-code{margin:0;padding:16px;font-family:inherit;font-size:13px;line-height:1.6;color:var(--text-primary, #0f172a);white-space:pre-wrap;word-wrap:break-word;pointer-events:none;z-index:1;overflow-y:auto}.cursor-pipe{color:var(--primary-color, #4f46e5);font-weight:700;animation:blink 1s step-end infinite}@keyframes blink{0%,to{opacity:0}50%{opacity:1}}.ghost-text{color:var(--text-muted, #94a3b8);font-style:italic;opacity:.7}.editor-footer{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--border-light, #f1f5f9);border-top:1px solid var(--border-color, #e2e8f0);gap:12px;flex-wrap:wrap}.editor-footer.justify-end{justify-content:flex-end}.suggestion-info{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-secondary, #475569)}.sparkle{font-size:14px}.editor-kbd{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:3px;box-shadow:0 1px #0000001a;padding:1px 4px;font-size:11px;font-family:sans-serif;font-weight:600;color:var(--text-primary, #0f172a)}.action-buttons{display:flex;gap:8px}.footer-btn{padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;cursor:pointer;font-family:var(--ngx-font-family, sans-serif);transition:all .2s}.accept-btn{background:var(--primary-color, #4f46e5);border:1px solid var(--primary-color, #4f46e5);color:#fff}.accept-btn:hover{background:var(--primary-hover, #4338ca)}.reject-btn{background:transparent;border:1px solid var(--border-color, #e2e8f0);color:var(--text-secondary, #475569)}.reject-btn:hover{background:#0000000a;border-color:var(--text-secondary, #475569)}.primary-btn{background:var(--primary-color, #4f46e5);border:1px solid var(--primary-color, #4f46e5);color:#fff}.primary-btn:hover{background:var(--primary-hover, #4338ca)}.secondary-btn{background:transparent;border:1px solid var(--border-color, #e2e8f0);color:var(--text-secondary, #475569)}.secondary-btn:hover{background:#0000000a}.explanation-panel{background:linear-gradient(to right,#4f46e508,#7c3aed08);border-top:1px solid var(--border-color, #e2e8f0);padding:16px}.explanation-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-weight:700;font-size:13px;color:var(--primary-color, #4f46e5);font-family:var(--ngx-font-family, sans-serif)}.close-explanation-btn{background:transparent;border:none;color:var(--text-muted, #94a3b8);font-size:14px;cursor:pointer}.close-explanation-btn:hover{color:var(--text-primary, #0f172a)}.explanation-body{font-size:12px;line-height:1.6;color:var(--text-secondary, #475569);font-family:var(--ngx-font-family, sans-serif)}.code-editor-wrapper.dark{border-color:#1f2937;background:#0f172a;box-shadow:0 4px 6px -1px #00000080}.code-editor-wrapper.dark .editor-header{background:#1e293b;border-bottom-color:#1f2937}.code-editor-wrapper.dark .editor-lang-badge{color:#94a3b8;background:#ffffff0d}.code-editor-wrapper.dark .icon-btn{color:#94a3b8}.code-editor-wrapper.dark .icon-btn:hover{background:#ffffff0d;color:#f8fafc}.code-editor-wrapper.dark .ai-pill{background:linear-gradient(135deg,#6366f11a,#a855f71a);color:#a5b4fc;border-color:#a855f733}.code-editor-wrapper.dark .editor-canvas{background:#0f172a}.code-editor-wrapper.dark .line-numbers{border-right-color:#1f2937;background:#ffffff03}.code-editor-wrapper.dark .line-num{color:#4b5563}.code-editor-wrapper.dark .rendered-code{color:#e2e8f0}.code-editor-wrapper.dark .ghost-text{color:#4b5563}.code-editor-wrapper.dark .editor-footer{background:#1e293b;border-top-color:#1f2937}.code-editor-wrapper.dark .suggestion-info{color:#94a3b8}.code-editor-wrapper.dark .editor-kbd{background:#0f172a;border-color:#1f2937;color:#f8fafc}.code-editor-wrapper.dark .reject-btn{border-color:#374151;color:#94a3b8}.code-editor-wrapper.dark .reject-btn:hover{background:#ffffff0a;border-color:#94a3b8}.code-editor-wrapper.dark .secondary-btn{border-color:#374151;color:#94a3b8}.code-editor-wrapper.dark .secondary-btn:hover{background:#ffffff0a}.code-editor-wrapper.dark .explanation-panel{background:linear-gradient(to right,#6366f108,#a855f708);border-top-color:#1f2937}.code-editor-wrapper.dark .explanation-header{color:#818cf8}.code-editor-wrapper.dark .explanation-body{color:#94a3b8}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.UpperCasePipe, name: "uppercase" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
1205
|
+
}
|
|
1206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AICodeEditorComponent, decorators: [{
|
|
1207
|
+
type: Component,
|
|
1208
|
+
args: [{ selector: 'ngx-ai-code-editor', standalone: true, imports: [CommonModule, FormsModule], template: `
|
|
1209
|
+
<div class="code-editor-wrapper" [class.dark]="theme() === 'dark'" [class.focused]="isFocused()">
|
|
1210
|
+
<!-- Toolbar Header -->
|
|
1211
|
+
<div class="editor-header">
|
|
1212
|
+
<div class="header-left">
|
|
1213
|
+
<span class="editor-dot red"></span>
|
|
1214
|
+
<span class="editor-dot yellow"></span>
|
|
1215
|
+
<span class="editor-dot green"></span>
|
|
1216
|
+
<span class="editor-lang-badge">{{ language() | uppercase }}</span>
|
|
1217
|
+
</div>
|
|
1218
|
+
<div class="header-right">
|
|
1219
|
+
<span class="ai-pill">✨ AI Suggestion Active</span>
|
|
1220
|
+
<button class="icon-btn" (click)="copyCode()" [title]="copyTooltip()">
|
|
1221
|
+
{{ copyText() }}
|
|
1222
|
+
</button>
|
|
1223
|
+
</div>
|
|
1224
|
+
</div>
|
|
1225
|
+
|
|
1226
|
+
<!-- Editor Canvas -->
|
|
1227
|
+
<div class="editor-canvas" (click)="focusTextarea()">
|
|
1228
|
+
<!-- Line Numbers -->
|
|
1229
|
+
<div class="line-numbers">
|
|
1230
|
+
@for (line of lines(); track $index) {
|
|
1231
|
+
<div class="line-num">{{ $index + 1 }}</div>
|
|
1232
|
+
}
|
|
1233
|
+
</div>
|
|
1234
|
+
|
|
1235
|
+
<!-- Code Content Area -->
|
|
1236
|
+
<div class="code-content-container">
|
|
1237
|
+
<textarea
|
|
1238
|
+
#editorInput
|
|
1239
|
+
class="hidden-textarea"
|
|
1240
|
+
[ngModel]="code()"
|
|
1241
|
+
(ngModelChange)="onCodeChange($event)"
|
|
1242
|
+
(focus)="isFocused.set(true)"
|
|
1243
|
+
(blur)="isFocused.set(false)"
|
|
1244
|
+
(keydown)="handleKeydown($event)"
|
|
1245
|
+
[disabled]="disabled()"
|
|
1246
|
+
></textarea>
|
|
1247
|
+
|
|
1248
|
+
<!-- Rendered Code Grid with Ghost Text -->
|
|
1249
|
+
<pre class="rendered-code"><code>{{ code() }}<span class="cursor-pipe" *ngIf="isFocused()">|</span><span
|
|
1250
|
+
*ngIf="suggestion() && !suggestionAccepted()"
|
|
1251
|
+
class="ghost-text"
|
|
1252
|
+
>{{ suggestion() }}</span></code></pre>
|
|
1253
|
+
</div>
|
|
1254
|
+
</div>
|
|
1255
|
+
|
|
1256
|
+
<!-- Suggestion Panel Controls -->
|
|
1257
|
+
<div class="editor-footer" *ngIf="suggestion() && !suggestionAccepted()">
|
|
1258
|
+
<div class="suggestion-info">
|
|
1259
|
+
<span class="sparkle">✨</span>
|
|
1260
|
+
<span class="desc">Press <kbd class="editor-kbd">Tab</kbd> to accept suggestion, or <kbd class="editor-kbd">Esc</kbd> to dismiss.</span>
|
|
1261
|
+
</div>
|
|
1262
|
+
<div class="action-buttons">
|
|
1263
|
+
<button class="footer-btn reject-btn" (click)="decline()">Decline (Esc)</button>
|
|
1264
|
+
<button class="footer-btn accept-btn" (click)="accept()">Accept (Tab)</button>
|
|
1265
|
+
</div>
|
|
1266
|
+
</div>
|
|
1267
|
+
|
|
1268
|
+
<!-- Explanation Panel -->
|
|
1269
|
+
<div class="explanation-panel" *ngIf="explanation() && showExplanation()">
|
|
1270
|
+
<div class="explanation-header">
|
|
1271
|
+
<span class="sparkle">💡 AI Explanation</span>
|
|
1272
|
+
<button class="close-explanation-btn" (click)="showExplanation.set(false)">✕</button>
|
|
1273
|
+
</div>
|
|
1274
|
+
<div class="explanation-body">
|
|
1275
|
+
{{ explanation() }}
|
|
1276
|
+
</div>
|
|
1277
|
+
</div>
|
|
1278
|
+
|
|
1279
|
+
<!-- Secondary Panel Controls (when suggestion is accepted or inactive) -->
|
|
1280
|
+
<div class="editor-footer justify-end" *ngIf="!suggestion() || suggestionAccepted()">
|
|
1281
|
+
<div class="action-buttons">
|
|
1282
|
+
<button class="footer-btn secondary-btn" (click)="explainSuggestedCode()">Explain Code</button>
|
|
1283
|
+
<button class="footer-btn primary-btn" (click)="triggerRegenerate()">Re-generate Suggestion</button>
|
|
1284
|
+
</div>
|
|
1285
|
+
</div>
|
|
1286
|
+
</div>
|
|
1287
|
+
`, styles: [":host{display:block;width:100%;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace}.code-editor-wrapper{border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);background:var(--bg-secondary, #ffffff);box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));overflow:hidden;display:flex;flex-direction:column;transition:all .25s cubic-bezier(.4,0,.2,1)}.code-editor-wrapper.focused{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.editor-header{display:flex;justify-content:space-between;align-items:center;padding:10px 16px;background:var(--border-light, #f1f5f9);border-bottom:1px solid var(--border-color, #e2e8f0)}.header-left{display:flex;align-items:center;gap:6px}.editor-dot{width:10px;height:10px;border-radius:50%}.editor-dot.red{background:#ef4444}.editor-dot.yellow{background:#f59e0b}.editor-dot.green{background:#10b981}.editor-lang-badge{margin-left:10px;font-size:11px;font-weight:700;color:var(--text-secondary, #475569);background:#0000000d;padding:2px 6px;border-radius:4px;letter-spacing:.5px}.header-right{display:flex;align-items:center;gap:12px}.ai-pill{font-size:11px;font-weight:600;background:linear-gradient(135deg,#4f46e51a,#7c3aed1a);color:#6d28d9;padding:2px 8px;border-radius:9999px;border:1px solid rgba(124,58,237,.2)}.icon-btn{background:transparent;border:none;color:var(--text-secondary, #475569);cursor:pointer;font-size:11px;padding:4px 8px;border-radius:4px;transition:background .2s}.icon-btn:hover{background:#0000000d;color:var(--text-primary, #0f172a)}.editor-canvas{display:flex;flex-direction:row;position:relative;min-height:150px;background:var(--bg-secondary, #ffffff);cursor:text}.line-numbers{padding:16px 8px 16px 12px;border-right:1px solid var(--border-color, #e2e8f0);background:#00000003;-webkit-user-select:none;user-select:none;text-align:right;min-width:40px}.line-num{color:var(--text-muted, #94a3b8);font-size:12px;line-height:1.6;height:19.2px}.code-content-container{position:relative;flex:1;overflow:hidden}.hidden-textarea{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;z-index:2;resize:none;border:none;outline:none;padding:16px;font-family:inherit;font-size:13px;line-height:1.6;white-space:pre-wrap;word-wrap:break-word}.rendered-code{margin:0;padding:16px;font-family:inherit;font-size:13px;line-height:1.6;color:var(--text-primary, #0f172a);white-space:pre-wrap;word-wrap:break-word;pointer-events:none;z-index:1;overflow-y:auto}.cursor-pipe{color:var(--primary-color, #4f46e5);font-weight:700;animation:blink 1s step-end infinite}@keyframes blink{0%,to{opacity:0}50%{opacity:1}}.ghost-text{color:var(--text-muted, #94a3b8);font-style:italic;opacity:.7}.editor-footer{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--border-light, #f1f5f9);border-top:1px solid var(--border-color, #e2e8f0);gap:12px;flex-wrap:wrap}.editor-footer.justify-end{justify-content:flex-end}.suggestion-info{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-secondary, #475569)}.sparkle{font-size:14px}.editor-kbd{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:3px;box-shadow:0 1px #0000001a;padding:1px 4px;font-size:11px;font-family:sans-serif;font-weight:600;color:var(--text-primary, #0f172a)}.action-buttons{display:flex;gap:8px}.footer-btn{padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;cursor:pointer;font-family:var(--ngx-font-family, sans-serif);transition:all .2s}.accept-btn{background:var(--primary-color, #4f46e5);border:1px solid var(--primary-color, #4f46e5);color:#fff}.accept-btn:hover{background:var(--primary-hover, #4338ca)}.reject-btn{background:transparent;border:1px solid var(--border-color, #e2e8f0);color:var(--text-secondary, #475569)}.reject-btn:hover{background:#0000000a;border-color:var(--text-secondary, #475569)}.primary-btn{background:var(--primary-color, #4f46e5);border:1px solid var(--primary-color, #4f46e5);color:#fff}.primary-btn:hover{background:var(--primary-hover, #4338ca)}.secondary-btn{background:transparent;border:1px solid var(--border-color, #e2e8f0);color:var(--text-secondary, #475569)}.secondary-btn:hover{background:#0000000a}.explanation-panel{background:linear-gradient(to right,#4f46e508,#7c3aed08);border-top:1px solid var(--border-color, #e2e8f0);padding:16px}.explanation-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-weight:700;font-size:13px;color:var(--primary-color, #4f46e5);font-family:var(--ngx-font-family, sans-serif)}.close-explanation-btn{background:transparent;border:none;color:var(--text-muted, #94a3b8);font-size:14px;cursor:pointer}.close-explanation-btn:hover{color:var(--text-primary, #0f172a)}.explanation-body{font-size:12px;line-height:1.6;color:var(--text-secondary, #475569);font-family:var(--ngx-font-family, sans-serif)}.code-editor-wrapper.dark{border-color:#1f2937;background:#0f172a;box-shadow:0 4px 6px -1px #00000080}.code-editor-wrapper.dark .editor-header{background:#1e293b;border-bottom-color:#1f2937}.code-editor-wrapper.dark .editor-lang-badge{color:#94a3b8;background:#ffffff0d}.code-editor-wrapper.dark .icon-btn{color:#94a3b8}.code-editor-wrapper.dark .icon-btn:hover{background:#ffffff0d;color:#f8fafc}.code-editor-wrapper.dark .ai-pill{background:linear-gradient(135deg,#6366f11a,#a855f71a);color:#a5b4fc;border-color:#a855f733}.code-editor-wrapper.dark .editor-canvas{background:#0f172a}.code-editor-wrapper.dark .line-numbers{border-right-color:#1f2937;background:#ffffff03}.code-editor-wrapper.dark .line-num{color:#4b5563}.code-editor-wrapper.dark .rendered-code{color:#e2e8f0}.code-editor-wrapper.dark .ghost-text{color:#4b5563}.code-editor-wrapper.dark .editor-footer{background:#1e293b;border-top-color:#1f2937}.code-editor-wrapper.dark .suggestion-info{color:#94a3b8}.code-editor-wrapper.dark .editor-kbd{background:#0f172a;border-color:#1f2937;color:#f8fafc}.code-editor-wrapper.dark .reject-btn{border-color:#374151;color:#94a3b8}.code-editor-wrapper.dark .reject-btn:hover{background:#ffffff0a;border-color:#94a3b8}.code-editor-wrapper.dark .secondary-btn{border-color:#374151;color:#94a3b8}.code-editor-wrapper.dark .secondary-btn:hover{background:#ffffff0a}.code-editor-wrapper.dark .explanation-panel{background:linear-gradient(to right,#6366f108,#a855f708);border-top-color:#1f2937}.code-editor-wrapper.dark .explanation-header{color:#818cf8}.code-editor-wrapper.dark .explanation-body{color:#94a3b8}\n"] }]
|
|
1288
|
+
}], propDecorators: { editorInput: [{
|
|
1289
|
+
type: ViewChild,
|
|
1290
|
+
args: ['editorInput']
|
|
1291
|
+
}] } });
|
|
1292
|
+
|
|
1293
|
+
class AIAudioWaveComponent {
|
|
1294
|
+
// Inputs
|
|
1295
|
+
state = input('idle');
|
|
1296
|
+
color = input('');
|
|
1297
|
+
theme = input('light');
|
|
1298
|
+
muted = input(false);
|
|
1299
|
+
// Outputs
|
|
1300
|
+
stateChange = output();
|
|
1301
|
+
mutedChange = output();
|
|
1302
|
+
micToggle = output();
|
|
1303
|
+
// State
|
|
1304
|
+
micEnabled = signal(true);
|
|
1305
|
+
localMuted = signal(false);
|
|
1306
|
+
speedMultiplier = signal(1.0);
|
|
1307
|
+
// Pre-configured equalizer bars representation
|
|
1308
|
+
bars = [
|
|
1309
|
+
{ height: 16, delay: '0.1s' },
|
|
1310
|
+
{ height: 28, delay: '0.3s' },
|
|
1311
|
+
{ height: 42, delay: '0.5s' },
|
|
1312
|
+
{ height: 50, delay: '0.2s' },
|
|
1313
|
+
{ height: 36, delay: '0.4s' },
|
|
1314
|
+
{ height: 22, delay: '0.6s' },
|
|
1315
|
+
{ height: 30, delay: '0.15s' },
|
|
1316
|
+
{ height: 48, delay: '0.35s' },
|
|
1317
|
+
{ height: 52, delay: '0.55s' },
|
|
1318
|
+
{ height: 38, delay: '0.25s' },
|
|
1319
|
+
{ height: 24, delay: '0.45s' },
|
|
1320
|
+
{ height: 14, delay: '0.05s' }
|
|
1321
|
+
];
|
|
1322
|
+
isMuted = computed(() => this.muted() || this.localMuted() || !this.micEnabled());
|
|
1323
|
+
stateLabel = computed(() => {
|
|
1324
|
+
switch (this.state()) {
|
|
1325
|
+
case 'listening': return 'Listening...';
|
|
1326
|
+
case 'thinking': return 'Thinking...';
|
|
1327
|
+
case 'speaking': return 'Speaking...';
|
|
1328
|
+
default: return 'Assistant Idle';
|
|
1329
|
+
}
|
|
1330
|
+
});
|
|
1331
|
+
volumePercent = computed(() => {
|
|
1332
|
+
if (this.isMuted())
|
|
1333
|
+
return 0;
|
|
1334
|
+
if (this.state() === 'idle')
|
|
1335
|
+
return 5;
|
|
1336
|
+
if (this.state() === 'listening')
|
|
1337
|
+
return 45;
|
|
1338
|
+
if (this.state() === 'thinking')
|
|
1339
|
+
return 12;
|
|
1340
|
+
if (this.state() === 'speaking')
|
|
1341
|
+
return 78;
|
|
1342
|
+
return 0;
|
|
1343
|
+
});
|
|
1344
|
+
barDuration = computed(() => {
|
|
1345
|
+
const rawVal = 1.0 / this.speedMultiplier();
|
|
1346
|
+
return `${rawVal.toFixed(2)}s`;
|
|
1347
|
+
});
|
|
1348
|
+
barColor = computed(() => {
|
|
1349
|
+
if (this.color())
|
|
1350
|
+
return this.color();
|
|
1351
|
+
// Context colors matching states
|
|
1352
|
+
if (this.isMuted())
|
|
1353
|
+
return '#94a3b8';
|
|
1354
|
+
switch (this.state()) {
|
|
1355
|
+
case 'listening': return '#10b981'; // Green
|
|
1356
|
+
case 'thinking': return '#3b82f6'; // Blue
|
|
1357
|
+
case 'speaking': return '#8b5cf6'; // Purple
|
|
1358
|
+
default: return '#cbd5e1'; // Muted slate
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
onSpeedChange(event) {
|
|
1362
|
+
const inputEl = event.target;
|
|
1363
|
+
if (inputEl) {
|
|
1364
|
+
this.speedMultiplier.set(parseFloat(inputEl.value));
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
toggleMic() {
|
|
1368
|
+
const nextVal = !this.micEnabled();
|
|
1369
|
+
this.micEnabled.set(nextVal);
|
|
1370
|
+
this.micToggle.emit(nextVal);
|
|
1371
|
+
}
|
|
1372
|
+
toggleMute() {
|
|
1373
|
+
const nextVal = !this.localMuted();
|
|
1374
|
+
this.localMuted.set(nextVal);
|
|
1375
|
+
this.mutedChange.emit(nextVal);
|
|
1376
|
+
}
|
|
1377
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIAudioWaveComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1378
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AIAudioWaveComponent, isStandalone: true, selector: "ngx-ai-audio-wave", inputs: { state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, muted: { classPropertyName: "muted", publicName: "muted", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { stateChange: "stateChange", mutedChange: "mutedChange", micToggle: "micToggle" }, ngImport: i0, template: `
|
|
1379
|
+
<div class="audio-wave-wrapper" [class.dark]="theme() === 'dark'">
|
|
1380
|
+
<!-- Status Badge & Description -->
|
|
1381
|
+
<div class="wave-header">
|
|
1382
|
+
<div class="state-indicator" [class]="state()">
|
|
1383
|
+
<span class="state-dot"></span>
|
|
1384
|
+
<span class="state-text">{{ stateLabel() }}</span>
|
|
1385
|
+
</div>
|
|
1386
|
+
<div class="amplitude-label" *ngIf="state() === 'speaking' || state() === 'listening'">
|
|
1387
|
+
Sensitivity: {{ volumePercent() }}%
|
|
1388
|
+
</div>
|
|
1389
|
+
</div>
|
|
1390
|
+
|
|
1391
|
+
<!-- Equalizer Wave Container -->
|
|
1392
|
+
<div class="equalizer-container" [class.muted]="isMuted()">
|
|
1393
|
+
@for (bar of bars; track bar) {
|
|
1394
|
+
<div
|
|
1395
|
+
class="wave-bar"
|
|
1396
|
+
[class]="state()"
|
|
1397
|
+
[style.animation-delay]="bar.delay"
|
|
1398
|
+
[style.animation-duration]="barDuration()"
|
|
1399
|
+
[style.height.px]="bar.height"
|
|
1400
|
+
[style.background]="barColor()"
|
|
1401
|
+
></div>
|
|
1402
|
+
}
|
|
1403
|
+
</div>
|
|
1404
|
+
|
|
1405
|
+
<!-- Controls Panel -->
|
|
1406
|
+
<div class="controls-panel">
|
|
1407
|
+
<!-- Mic Toggle -->
|
|
1408
|
+
<button
|
|
1409
|
+
class="control-btn mic-btn"
|
|
1410
|
+
[class.active]="micEnabled() && !isMuted()"
|
|
1411
|
+
(click)="toggleMic()"
|
|
1412
|
+
[title]="micEnabled() ? 'Disable Microphone' : 'Enable Microphone'"
|
|
1413
|
+
>
|
|
1414
|
+
<!-- SVG Mic Icon -->
|
|
1415
|
+
<svg class="icon-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1416
|
+
@if (micEnabled()) {
|
|
1417
|
+
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/>
|
|
1418
|
+
<path d="M19 10v2a7 7 0 0 1-14 0v-2"/>
|
|
1419
|
+
<line x1="12" y1="19" x2="12" y2="23"/>
|
|
1420
|
+
<line x1="8" y1="23" x2="16" y2="23"/>
|
|
1421
|
+
} @else {
|
|
1422
|
+
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" opacity="0.4"/>
|
|
1423
|
+
<path d="M19 10v2a7 7 0 0 1-14 0v-2" opacity="0.4"/>
|
|
1424
|
+
<line x1="12" y1="19" x2="12" y2="23" opacity="0.4"/>
|
|
1425
|
+
<line x1="10" y1="23" x2="14" y2="23" opacity="0.4"/>
|
|
1426
|
+
<line x1="1" y1="1" x2="23" y2="23" stroke-width="2.5"/>
|
|
1427
|
+
}
|
|
1428
|
+
</svg>
|
|
1429
|
+
</button>
|
|
1430
|
+
|
|
1431
|
+
<!-- Mute/Unmute audio output -->
|
|
1432
|
+
<button
|
|
1433
|
+
class="control-btn volume-btn"
|
|
1434
|
+
[class.muted]="isMuted()"
|
|
1435
|
+
(click)="toggleMute()"
|
|
1436
|
+
[title]="isMuted() ? 'Unmute Audio' : 'Mute Audio'"
|
|
1437
|
+
>
|
|
1438
|
+
<!-- SVG Audio Icon -->
|
|
1439
|
+
<svg class="icon-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1440
|
+
@if (!isMuted()) {
|
|
1441
|
+
<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>
|
|
1442
|
+
<path d="M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"/>
|
|
1443
|
+
} @else {
|
|
1444
|
+
<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" opacity="0.4"/>
|
|
1445
|
+
<line x1="23" y1="9" x2="17" y2="15"/>
|
|
1446
|
+
<line x1="17" y1="9" x2="23" y2="15"/>
|
|
1447
|
+
}
|
|
1448
|
+
</svg>
|
|
1449
|
+
</button>
|
|
1450
|
+
|
|
1451
|
+
<!-- Wave Sensitivity/Speed slider -->
|
|
1452
|
+
<div class="slider-container" *ngIf="state() === 'speaking' || state() === 'listening'">
|
|
1453
|
+
<span class="slider-label">Speed</span>
|
|
1454
|
+
<input
|
|
1455
|
+
type="range"
|
|
1456
|
+
min="0.3"
|
|
1457
|
+
max="2.0"
|
|
1458
|
+
step="0.1"
|
|
1459
|
+
[value]="speedMultiplier()"
|
|
1460
|
+
(input)="onSpeedChange($event)"
|
|
1461
|
+
class="wave-speed-slider"
|
|
1462
|
+
/>
|
|
1463
|
+
</div>
|
|
1464
|
+
</div>
|
|
1465
|
+
</div>
|
|
1466
|
+
`, isInline: true, styles: [":host{display:block;width:100%}.audio-wave-wrapper{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);padding:20px;box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));display:flex;flex-direction:column;gap:20px;transition:background .3s,border-color .3s}.wave-header{display:flex;justify-content:space-between;align-items:center;font-family:var(--ngx-font-family, sans-serif)}.state-indicator{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:700}.state-dot{width:8px;height:8px;border-radius:50%;background:#94a3b8;transition:background .3s}.state-indicator.idle .state-dot{background:#94a3b8}.state-indicator.listening .state-dot{background:#10b981;animation:blink 1.2s infinite}.state-indicator.thinking .state-dot{background:#3b82f6;animation:spin-color 2s infinite}.state-indicator.speaking .state-dot{background:#8b5cf6}.state-indicator.idle{color:var(--text-secondary, #475569)}.state-indicator.listening{color:#10b981}.state-indicator.thinking{color:#3b82f6}.state-indicator.speaking{color:#8b5cf6}@keyframes blink{0%,to{opacity:1}50%{opacity:.3}}@keyframes spin-color{0%{transform:scale(1);filter:brightness(1)}50%{transform:scale(1.2);filter:brightness(1.2)}to{transform:scale(1);filter:brightness(1)}}.amplitude-label{font-size:11px;color:var(--text-secondary, #475569);font-weight:500}.equalizer-container{display:flex;justify-content:center;align-items:center;gap:4px;height:70px;padding:0 10px;border-radius:var(--radius-sm, 6px);background:var(--border-light, #f1f5f9);overflow:hidden;transition:background .3s,opacity .3s}.equalizer-container.muted{opacity:.5}.wave-bar{width:4px;border-radius:9999px;transition:height .3s,background .3s}.wave-bar.idle{height:6px!important;opacity:.4}.wave-bar.listening{animation:listenPulse 1s ease-in-out infinite alternate}@keyframes listenPulse{0%{transform:scaleY(1)}to{transform:scaleY(3.5)}}.wave-bar.thinking{animation:thinkFlow 1.6s ease-in-out infinite}@keyframes thinkFlow{0%,to{transform:scaleY(1.2)}50%{transform:scaleY(5)}}.wave-bar.speaking{animation:speakBounce .8s cubic-bezier(.25,.8,.25,1) infinite alternate}@keyframes speakBounce{0%{transform:scaleY(1)}to{transform:scaleY(7.5)}}.controls-panel{display:flex;align-items:center;gap:12px;border-top:1px solid var(--border-color, #e2e8f0);padding-top:16px}.control-btn{width:38px;height:38px;border-radius:50%;border:1px solid var(--border-color, #e2e8f0);background:transparent;color:var(--text-secondary, #475569);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .25s}.control-btn:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a);border-color:var(--text-secondary, #475569)}.control-btn.active{background:var(--primary-color, #4f46e5);color:#fff;border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.control-btn.muted{color:#ef4444;border-color:#ef444433;background:#ef44440d}.control-btn.muted:hover{background:#ef44441a}.icon-svg{width:18px;height:18px}.slider-container{display:flex;align-items:center;gap:8px;margin-left:auto;font-family:var(--ngx-font-family, sans-serif);font-size:11px;color:var(--text-secondary, #475569)}.wave-speed-slider{width:80px;height:4px;background:var(--border-color, #e2e8f0);border-radius:2px;outline:none;-webkit-appearance:none;cursor:pointer}.wave-speed-slider::-webkit-slider-thumb{-webkit-appearance:none;width:12px;height:12px;border-radius:50%;background:var(--primary-color, #4f46e5);transition:transform .15s}.wave-speed-slider::-webkit-slider-thumb:hover{transform:scale(1.2)}.audio-wave-wrapper.dark{background:#0f172a;border-color:#1f2937}.audio-wave-wrapper.dark .equalizer-container{background:#1e293b}.audio-wave-wrapper.dark .control-btn{border-color:#374151;color:#94a3b8}.audio-wave-wrapper.dark .control-btn:hover{background:#1e293b;color:#f8fafc;border-color:#94a3b8}.audio-wave-wrapper.dark .control-btn.active{background:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1);color:#fff}.audio-wave-wrapper.dark .controls-panel{border-top-color:#1f2937}.audio-wave-wrapper.dark .amplitude-label,.audio-wave-wrapper.dark .slider-label{color:#94a3b8}.audio-wave-wrapper.dark .wave-speed-slider{background:#374151}.audio-wave-wrapper.dark .wave-speed-slider::-webkit-slider-thumb{background:var(--primary-color, #6366f1)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
1467
|
+
}
|
|
1468
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIAudioWaveComponent, decorators: [{
|
|
1469
|
+
type: Component,
|
|
1470
|
+
args: [{ selector: 'ngx-ai-audio-wave', standalone: true, imports: [CommonModule], template: `
|
|
1471
|
+
<div class="audio-wave-wrapper" [class.dark]="theme() === 'dark'">
|
|
1472
|
+
<!-- Status Badge & Description -->
|
|
1473
|
+
<div class="wave-header">
|
|
1474
|
+
<div class="state-indicator" [class]="state()">
|
|
1475
|
+
<span class="state-dot"></span>
|
|
1476
|
+
<span class="state-text">{{ stateLabel() }}</span>
|
|
1477
|
+
</div>
|
|
1478
|
+
<div class="amplitude-label" *ngIf="state() === 'speaking' || state() === 'listening'">
|
|
1479
|
+
Sensitivity: {{ volumePercent() }}%
|
|
1480
|
+
</div>
|
|
1481
|
+
</div>
|
|
1482
|
+
|
|
1483
|
+
<!-- Equalizer Wave Container -->
|
|
1484
|
+
<div class="equalizer-container" [class.muted]="isMuted()">
|
|
1485
|
+
@for (bar of bars; track bar) {
|
|
1486
|
+
<div
|
|
1487
|
+
class="wave-bar"
|
|
1488
|
+
[class]="state()"
|
|
1489
|
+
[style.animation-delay]="bar.delay"
|
|
1490
|
+
[style.animation-duration]="barDuration()"
|
|
1491
|
+
[style.height.px]="bar.height"
|
|
1492
|
+
[style.background]="barColor()"
|
|
1493
|
+
></div>
|
|
1494
|
+
}
|
|
1495
|
+
</div>
|
|
1496
|
+
|
|
1497
|
+
<!-- Controls Panel -->
|
|
1498
|
+
<div class="controls-panel">
|
|
1499
|
+
<!-- Mic Toggle -->
|
|
1500
|
+
<button
|
|
1501
|
+
class="control-btn mic-btn"
|
|
1502
|
+
[class.active]="micEnabled() && !isMuted()"
|
|
1503
|
+
(click)="toggleMic()"
|
|
1504
|
+
[title]="micEnabled() ? 'Disable Microphone' : 'Enable Microphone'"
|
|
1505
|
+
>
|
|
1506
|
+
<!-- SVG Mic Icon -->
|
|
1507
|
+
<svg class="icon-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1508
|
+
@if (micEnabled()) {
|
|
1509
|
+
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/>
|
|
1510
|
+
<path d="M19 10v2a7 7 0 0 1-14 0v-2"/>
|
|
1511
|
+
<line x1="12" y1="19" x2="12" y2="23"/>
|
|
1512
|
+
<line x1="8" y1="23" x2="16" y2="23"/>
|
|
1513
|
+
} @else {
|
|
1514
|
+
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" opacity="0.4"/>
|
|
1515
|
+
<path d="M19 10v2a7 7 0 0 1-14 0v-2" opacity="0.4"/>
|
|
1516
|
+
<line x1="12" y1="19" x2="12" y2="23" opacity="0.4"/>
|
|
1517
|
+
<line x1="10" y1="23" x2="14" y2="23" opacity="0.4"/>
|
|
1518
|
+
<line x1="1" y1="1" x2="23" y2="23" stroke-width="2.5"/>
|
|
1519
|
+
}
|
|
1520
|
+
</svg>
|
|
1521
|
+
</button>
|
|
1522
|
+
|
|
1523
|
+
<!-- Mute/Unmute audio output -->
|
|
1524
|
+
<button
|
|
1525
|
+
class="control-btn volume-btn"
|
|
1526
|
+
[class.muted]="isMuted()"
|
|
1527
|
+
(click)="toggleMute()"
|
|
1528
|
+
[title]="isMuted() ? 'Unmute Audio' : 'Mute Audio'"
|
|
1529
|
+
>
|
|
1530
|
+
<!-- SVG Audio Icon -->
|
|
1531
|
+
<svg class="icon-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1532
|
+
@if (!isMuted()) {
|
|
1533
|
+
<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/>
|
|
1534
|
+
<path d="M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"/>
|
|
1535
|
+
} @else {
|
|
1536
|
+
<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" opacity="0.4"/>
|
|
1537
|
+
<line x1="23" y1="9" x2="17" y2="15"/>
|
|
1538
|
+
<line x1="17" y1="9" x2="23" y2="15"/>
|
|
1539
|
+
}
|
|
1540
|
+
</svg>
|
|
1541
|
+
</button>
|
|
1542
|
+
|
|
1543
|
+
<!-- Wave Sensitivity/Speed slider -->
|
|
1544
|
+
<div class="slider-container" *ngIf="state() === 'speaking' || state() === 'listening'">
|
|
1545
|
+
<span class="slider-label">Speed</span>
|
|
1546
|
+
<input
|
|
1547
|
+
type="range"
|
|
1548
|
+
min="0.3"
|
|
1549
|
+
max="2.0"
|
|
1550
|
+
step="0.1"
|
|
1551
|
+
[value]="speedMultiplier()"
|
|
1552
|
+
(input)="onSpeedChange($event)"
|
|
1553
|
+
class="wave-speed-slider"
|
|
1554
|
+
/>
|
|
1555
|
+
</div>
|
|
1556
|
+
</div>
|
|
1557
|
+
</div>
|
|
1558
|
+
`, styles: [":host{display:block;width:100%}.audio-wave-wrapper{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);padding:20px;box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));display:flex;flex-direction:column;gap:20px;transition:background .3s,border-color .3s}.wave-header{display:flex;justify-content:space-between;align-items:center;font-family:var(--ngx-font-family, sans-serif)}.state-indicator{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:700}.state-dot{width:8px;height:8px;border-radius:50%;background:#94a3b8;transition:background .3s}.state-indicator.idle .state-dot{background:#94a3b8}.state-indicator.listening .state-dot{background:#10b981;animation:blink 1.2s infinite}.state-indicator.thinking .state-dot{background:#3b82f6;animation:spin-color 2s infinite}.state-indicator.speaking .state-dot{background:#8b5cf6}.state-indicator.idle{color:var(--text-secondary, #475569)}.state-indicator.listening{color:#10b981}.state-indicator.thinking{color:#3b82f6}.state-indicator.speaking{color:#8b5cf6}@keyframes blink{0%,to{opacity:1}50%{opacity:.3}}@keyframes spin-color{0%{transform:scale(1);filter:brightness(1)}50%{transform:scale(1.2);filter:brightness(1.2)}to{transform:scale(1);filter:brightness(1)}}.amplitude-label{font-size:11px;color:var(--text-secondary, #475569);font-weight:500}.equalizer-container{display:flex;justify-content:center;align-items:center;gap:4px;height:70px;padding:0 10px;border-radius:var(--radius-sm, 6px);background:var(--border-light, #f1f5f9);overflow:hidden;transition:background .3s,opacity .3s}.equalizer-container.muted{opacity:.5}.wave-bar{width:4px;border-radius:9999px;transition:height .3s,background .3s}.wave-bar.idle{height:6px!important;opacity:.4}.wave-bar.listening{animation:listenPulse 1s ease-in-out infinite alternate}@keyframes listenPulse{0%{transform:scaleY(1)}to{transform:scaleY(3.5)}}.wave-bar.thinking{animation:thinkFlow 1.6s ease-in-out infinite}@keyframes thinkFlow{0%,to{transform:scaleY(1.2)}50%{transform:scaleY(5)}}.wave-bar.speaking{animation:speakBounce .8s cubic-bezier(.25,.8,.25,1) infinite alternate}@keyframes speakBounce{0%{transform:scaleY(1)}to{transform:scaleY(7.5)}}.controls-panel{display:flex;align-items:center;gap:12px;border-top:1px solid var(--border-color, #e2e8f0);padding-top:16px}.control-btn{width:38px;height:38px;border-radius:50%;border:1px solid var(--border-color, #e2e8f0);background:transparent;color:var(--text-secondary, #475569);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .25s}.control-btn:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a);border-color:var(--text-secondary, #475569)}.control-btn.active{background:var(--primary-color, #4f46e5);color:#fff;border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.control-btn.muted{color:#ef4444;border-color:#ef444433;background:#ef44440d}.control-btn.muted:hover{background:#ef44441a}.icon-svg{width:18px;height:18px}.slider-container{display:flex;align-items:center;gap:8px;margin-left:auto;font-family:var(--ngx-font-family, sans-serif);font-size:11px;color:var(--text-secondary, #475569)}.wave-speed-slider{width:80px;height:4px;background:var(--border-color, #e2e8f0);border-radius:2px;outline:none;-webkit-appearance:none;cursor:pointer}.wave-speed-slider::-webkit-slider-thumb{-webkit-appearance:none;width:12px;height:12px;border-radius:50%;background:var(--primary-color, #4f46e5);transition:transform .15s}.wave-speed-slider::-webkit-slider-thumb:hover{transform:scale(1.2)}.audio-wave-wrapper.dark{background:#0f172a;border-color:#1f2937}.audio-wave-wrapper.dark .equalizer-container{background:#1e293b}.audio-wave-wrapper.dark .control-btn{border-color:#374151;color:#94a3b8}.audio-wave-wrapper.dark .control-btn:hover{background:#1e293b;color:#f8fafc;border-color:#94a3b8}.audio-wave-wrapper.dark .control-btn.active{background:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1);color:#fff}.audio-wave-wrapper.dark .controls-panel{border-top-color:#1f2937}.audio-wave-wrapper.dark .amplitude-label,.audio-wave-wrapper.dark .slider-label{color:#94a3b8}.audio-wave-wrapper.dark .wave-speed-slider{background:#374151}.audio-wave-wrapper.dark .wave-speed-slider::-webkit-slider-thumb{background:var(--primary-color, #6366f1)}\n"] }]
|
|
1559
|
+
}] });
|
|
1560
|
+
|
|
1561
|
+
class AIModelCompareComponent {
|
|
1562
|
+
// Inputs
|
|
1563
|
+
models = input([]);
|
|
1564
|
+
theme = input('light');
|
|
1565
|
+
// Outputs
|
|
1566
|
+
modelSelected = output();
|
|
1567
|
+
// State
|
|
1568
|
+
searchQuery = signal('');
|
|
1569
|
+
activeTag = signal('all');
|
|
1570
|
+
selectedModel = signal(null);
|
|
1571
|
+
// Available Filter Tags
|
|
1572
|
+
tags = [
|
|
1573
|
+
{ label: 'All Models', value: 'all' },
|
|
1574
|
+
{ label: 'Fastest (< 1.2s)', value: 'fast' },
|
|
1575
|
+
{ label: 'Cheapest ($/1M)', value: 'cheap' },
|
|
1576
|
+
{ label: 'Vision Support', value: 'vision' },
|
|
1577
|
+
{ label: 'Coding Tools', value: 'code' }
|
|
1578
|
+
];
|
|
1579
|
+
// Helper calculation for latency meter width
|
|
1580
|
+
getLatencyPercentage(val) {
|
|
1581
|
+
// Max scale set to 5.0 seconds
|
|
1582
|
+
const percentage = (val / 5.0) * 100;
|
|
1583
|
+
return Math.min(Math.max(percentage, 5), 100);
|
|
1584
|
+
}
|
|
1585
|
+
// Filtered/searched list of models
|
|
1586
|
+
filteredModels = computed(() => {
|
|
1587
|
+
const query = this.searchQuery().toLowerCase().trim();
|
|
1588
|
+
const tag = this.activeTag();
|
|
1589
|
+
let list = this.models() || [];
|
|
1590
|
+
// Apply text search filter
|
|
1591
|
+
if (query) {
|
|
1592
|
+
list = list.filter(m => m.name.toLowerCase().includes(query) ||
|
|
1593
|
+
m.provider.toLowerCase().includes(query));
|
|
1594
|
+
}
|
|
1595
|
+
// Apply category tag filter
|
|
1596
|
+
if (tag === 'fast') {
|
|
1597
|
+
list = list.filter(m => m.avgLatency <= 1.2);
|
|
1598
|
+
}
|
|
1599
|
+
else if (tag === 'cheap') {
|
|
1600
|
+
// Cheapest input price: less than $5
|
|
1601
|
+
list = list.filter(m => m.pricingInput <= 5.0);
|
|
1602
|
+
}
|
|
1603
|
+
else if (tag === 'vision') {
|
|
1604
|
+
list = list.filter(m => m.capabilities.includes('vision'));
|
|
1605
|
+
}
|
|
1606
|
+
else if (tag === 'code') {
|
|
1607
|
+
list = list.filter(m => m.capabilities.includes('code'));
|
|
1608
|
+
}
|
|
1609
|
+
return list;
|
|
1610
|
+
});
|
|
1611
|
+
selectModel(model) {
|
|
1612
|
+
this.selectedModel.set(model);
|
|
1613
|
+
this.modelSelected.emit(model);
|
|
1614
|
+
}
|
|
1615
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIModelCompareComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1616
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AIModelCompareComponent, isStandalone: true, selector: "ngx-ai-model-compare", inputs: { models: { classPropertyName: "models", publicName: "models", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { modelSelected: "modelSelected" }, ngImport: i0, template: `
|
|
1617
|
+
<div class="model-compare-wrapper" [class.dark]="theme() === 'dark'">
|
|
1618
|
+
<!-- Toolbar Filter Bar -->
|
|
1619
|
+
<div class="toolbar-header">
|
|
1620
|
+
<div class="search-box">
|
|
1621
|
+
<span class="search-icon">🔍</span>
|
|
1622
|
+
<input
|
|
1623
|
+
type="text"
|
|
1624
|
+
[ngModel]="searchQuery()"
|
|
1625
|
+
(ngModelChange)="searchQuery.set($event)"
|
|
1626
|
+
placeholder="Search model or provider..."
|
|
1627
|
+
class="filter-input"
|
|
1628
|
+
/>
|
|
1629
|
+
</div>
|
|
1630
|
+
|
|
1631
|
+
<!-- Filter Tags -->
|
|
1632
|
+
<div class="filter-tags">
|
|
1633
|
+
@for (tag of tags; track tag.value) {
|
|
1634
|
+
<button
|
|
1635
|
+
class="tag-btn"
|
|
1636
|
+
[class.active]="activeTag() === tag.value"
|
|
1637
|
+
(click)="activeTag.set(tag.value)"
|
|
1638
|
+
>
|
|
1639
|
+
{{ tag.label }}
|
|
1640
|
+
</button>
|
|
1641
|
+
}
|
|
1642
|
+
</div>
|
|
1643
|
+
</div>
|
|
1644
|
+
|
|
1645
|
+
<!-- Comparison Grid Container -->
|
|
1646
|
+
<div class="table-container">
|
|
1647
|
+
<table class="compare-table">
|
|
1648
|
+
<thead>
|
|
1649
|
+
<tr>
|
|
1650
|
+
<th class="cell-model">Model</th>
|
|
1651
|
+
<th>Parameters</th>
|
|
1652
|
+
<th>Context</th>
|
|
1653
|
+
<th>Cost (In/Out per 1M)</th>
|
|
1654
|
+
<th class="cell-latency">Latency</th>
|
|
1655
|
+
<th>Capabilities</th>
|
|
1656
|
+
<th>Rating</th>
|
|
1657
|
+
<th class="cell-action">Action</th>
|
|
1658
|
+
</tr>
|
|
1659
|
+
</thead>
|
|
1660
|
+
<tbody>
|
|
1661
|
+
@if (filteredModels().length === 0) {
|
|
1662
|
+
<tr>
|
|
1663
|
+
<td colspan="8" class="empty-state">
|
|
1664
|
+
No models match the current filter or search criteria.
|
|
1665
|
+
</td>
|
|
1666
|
+
</tr>
|
|
1667
|
+
} @else {
|
|
1668
|
+
@for (model of filteredModels(); track model.name) {
|
|
1669
|
+
<tr
|
|
1670
|
+
class="model-row"
|
|
1671
|
+
[class.recommended]="model.recommended"
|
|
1672
|
+
[class.selected]="selectedModel()?.name === model.name"
|
|
1673
|
+
(click)="selectModel(model)"
|
|
1674
|
+
>
|
|
1675
|
+
<!-- Model Info -->
|
|
1676
|
+
<td class="cell-model">
|
|
1677
|
+
<div class="model-title-wrap">
|
|
1678
|
+
<div class="model-name">
|
|
1679
|
+
{{ model.name }}
|
|
1680
|
+
<span *ngIf="model.recommended" class="badge-recommended">Rec</span>
|
|
1681
|
+
<span *ngIf="model.status === 'beta'" class="badge-beta">Beta</span>
|
|
1682
|
+
</div>
|
|
1683
|
+
<div class="model-provider">{{ model.provider }}</div>
|
|
1684
|
+
</div>
|
|
1685
|
+
</td>
|
|
1686
|
+
|
|
1687
|
+
<!-- Parameters -->
|
|
1688
|
+
<td>
|
|
1689
|
+
<span class="param-tag">{{ model.parameters }}</span>
|
|
1690
|
+
</td>
|
|
1691
|
+
|
|
1692
|
+
<!-- Context Window -->
|
|
1693
|
+
<td>{{ model.contextWindow }}</td>
|
|
1694
|
+
|
|
1695
|
+
<!-- Pricing -->
|
|
1696
|
+
<td>
|
|
1697
|
+
<div class="pricing-wrap">
|
|
1698
|
+
<span class="price-val">\${{ model.pricingInput }}</span>
|
|
1699
|
+
<span class="price-slash">/</span>
|
|
1700
|
+
<span class="price-val">\${{ model.pricingOutput }}</span>
|
|
1701
|
+
</div>
|
|
1702
|
+
</td>
|
|
1703
|
+
|
|
1704
|
+
<!-- Latency Bar -->
|
|
1705
|
+
<td class="cell-latency">
|
|
1706
|
+
<div class="latency-graph-wrap">
|
|
1707
|
+
<div class="latency-metrics">
|
|
1708
|
+
<span>{{ model.avgLatency }}s</span>
|
|
1709
|
+
</div>
|
|
1710
|
+
<div class="bar-track">
|
|
1711
|
+
<div
|
|
1712
|
+
class="bar-fill"
|
|
1713
|
+
[style.width.%]="getLatencyPercentage(model.avgLatency)"
|
|
1714
|
+
[class.fast]="model.avgLatency <= 1.0"
|
|
1715
|
+
[class.moderate]="model.avgLatency > 1.0 && model.avgLatency <= 2.2"
|
|
1716
|
+
[class.slow]="model.avgLatency > 2.2"
|
|
1717
|
+
></div>
|
|
1718
|
+
</div>
|
|
1719
|
+
</div>
|
|
1720
|
+
</td>
|
|
1721
|
+
|
|
1722
|
+
<!-- Capabilities -->
|
|
1723
|
+
<td>
|
|
1724
|
+
<div class="capabilities-icons">
|
|
1725
|
+
<span [class.active]="model.capabilities.includes('text')" title="Text processing">💬</span>
|
|
1726
|
+
<span [class.active]="model.capabilities.includes('code')" title="Code generation">💻</span>
|
|
1727
|
+
<span [class.active]="model.capabilities.includes('vision')" title="Computer vision">👁️</span>
|
|
1728
|
+
<span [class.active]="model.capabilities.includes('audio')" title="Voice/Audio input">🎙️</span>
|
|
1729
|
+
</div>
|
|
1730
|
+
</td>
|
|
1731
|
+
|
|
1732
|
+
<!-- Rating -->
|
|
1733
|
+
<td>
|
|
1734
|
+
<div class="rating-stars" [title]="model.rating + ' stars'">
|
|
1735
|
+
@for (star of [1, 2, 3, 4, 5]; track star) {
|
|
1736
|
+
<span class="star" [class.filled]="star <= model.rating">★</span>
|
|
1737
|
+
}
|
|
1738
|
+
</div>
|
|
1739
|
+
</td>
|
|
1740
|
+
|
|
1741
|
+
<!-- Select Button -->
|
|
1742
|
+
<td class="cell-action" (click)="$event.stopPropagation()">
|
|
1743
|
+
<button
|
|
1744
|
+
class="select-btn"
|
|
1745
|
+
[class.active]="selectedModel()?.name === model.name"
|
|
1746
|
+
(click)="selectModel(model)"
|
|
1747
|
+
>
|
|
1748
|
+
{{ selectedModel()?.name === model.name ? 'Selected' : 'Compare' }}
|
|
1749
|
+
</button>
|
|
1750
|
+
</td>
|
|
1751
|
+
</tr>
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
</tbody>
|
|
1755
|
+
</table>
|
|
1756
|
+
</div>
|
|
1757
|
+
</div>
|
|
1758
|
+
`, isInline: true, styles: [":host{display:block;width:100%}.model-compare-wrapper{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));overflow:hidden;display:flex;flex-direction:column;transition:all .3s}.toolbar-header{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid var(--border-color, #e2e8f0);gap:16px;flex-wrap:wrap}.search-box{display:flex;align-items:center;gap:8px;border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-sm, 6px);padding:6px 12px;background:var(--bg-primary, #f8fafc);min-width:250px;flex:1;max-width:400px}.search-icon{font-size:14px}.filter-input{border:none;background:transparent;outline:none;font-size:13px;width:100%;color:var(--text-primary, #0f172a)}.filter-tags{display:flex;gap:8px;overflow-x:auto;padding-bottom:2px}.tag-btn{padding:6px 12px;font-size:12px;font-weight:600;border-radius:9999px;border:1px solid var(--border-color, #e2e8f0);background:transparent;color:var(--text-secondary, #475569);cursor:pointer;font-family:var(--ngx-font-family, sans-serif);transition:all .2s}.tag-btn:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.tag-btn.active{background:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5);color:#fff}.table-container{overflow-x:auto}.compare-table{width:100%;border-collapse:collapse;text-align:left;font-family:var(--ngx-font-family, sans-serif);font-size:13px}.compare-table th{padding:14px 20px;font-weight:700;color:var(--text-secondary, #475569);background:var(--border-light, #f1f5f9);border-bottom:1px solid var(--border-color, #e2e8f0);-webkit-user-select:none;user-select:none}.compare-table td{padding:16px 20px;border-bottom:1px solid var(--border-light, #f1f5f9);vertical-align:middle;color:var(--text-primary, #0f172a);transition:background .15s}.model-row{cursor:pointer}.model-row:hover td{background:#4f46e505}.model-row.selected td{background:#4f46e50d}.model-row.recommended{position:relative}.model-title-wrap{display:flex;flex-direction:column;gap:2px}.model-name{font-weight:700;display:flex;align-items:center;gap:6px}.model-provider{font-size:11px;color:var(--text-secondary, #475569)}.badge-recommended{background:#e0e7ff;color:#4f46e5;font-size:10px;padding:1px 6px;border-radius:4px;font-weight:700}.badge-beta{background:#fef3c7;color:#d97706;font-size:10px;padding:1px 6px;border-radius:4px;font-weight:700}.param-tag{background:var(--border-light, #f1f5f9);color:var(--text-secondary, #475569);padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600}.pricing-wrap{display:flex;align-items:center;font-weight:600}.price-slash{color:var(--text-muted, #94a3b8);margin:0 4px}.latency-graph-wrap{display:flex;flex-direction:column;gap:6px;width:100px}.latency-metrics{display:flex;justify-content:space-between;font-size:11px;font-weight:600;color:var(--text-secondary, #475569)}.bar-track{height:6px;background:var(--border-color, #e2e8f0);border-radius:3px;overflow:hidden}.bar-fill{height:100%;border-radius:3px}.bar-fill.fast{background:#10b981}.bar-fill.moderate{background:#f59e0b}.bar-fill.slow{background:#ef4444}.capabilities-icons{display:flex;gap:6px;font-size:15px}.capabilities-icons span{opacity:.2;filter:grayscale(1);transition:opacity .2s}.capabilities-icons span.active{opacity:1;filter:none}.rating-stars{color:#f59e0b;font-size:14px;letter-spacing:-2px;white-space:nowrap}.star{opacity:.2}.star.filled{opacity:1}.select-btn{padding:6px 12px;font-size:11px;font-weight:700;border-radius:6px;border:1px solid var(--border-color, #e2e8f0);background:transparent;color:var(--text-secondary, #475569);cursor:pointer;font-family:var(--ngx-font-family, sans-serif);transition:all .2s;width:76px}.select-btn:hover{background:#4f46e50d;color:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5)}.select-btn.active{background:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5);color:#fff}.empty-state{text-align:center;padding:30px!important;color:var(--text-secondary, #475569);font-style:italic}.model-compare-wrapper.dark{background:#0f172a;border-color:#1f2937}.model-compare-wrapper.dark .toolbar-header{border-bottom-color:#1f2937}.model-compare-wrapper.dark .search-box{border-color:#1f2937;background:#0b0f19}.model-compare-wrapper.dark .filter-input{color:#f8fafc}.model-compare-wrapper.dark .tag-btn{border-color:#374151;color:#94a3b8}.model-compare-wrapper.dark .tag-btn:hover{background:#1f2937;color:#f8fafc}.model-compare-wrapper.dark .tag-btn.active{background:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1);color:#fff}.model-compare-wrapper.dark .compare-table th{background:#1e293b;border-bottom-color:#1f2937;color:#94a3b8}.model-compare-wrapper.dark .compare-table td{border-bottom-color:#1f2937;color:#e2e8f0}.model-compare-wrapper.dark .model-row:hover td{background:#6366f105}.model-compare-wrapper.dark .model-row.selected td{background:#6366f10d}.model-compare-wrapper.dark .badge-recommended{background:#6366f126;color:#818cf8}.model-compare-wrapper.dark .badge-beta{background:#f59e0b26;color:#fbbf24}.model-compare-wrapper.dark .param-tag{background:#1e293b;color:#94a3b8}.model-compare-wrapper.dark .model-provider{color:#6b7280}.model-compare-wrapper.dark .bar-track{background:#1f2937}.model-compare-wrapper.dark .latency-metrics{color:#94a3b8}.model-compare-wrapper.dark .select-btn{border-color:#374151;color:#94a3b8}.model-compare-wrapper.dark .select-btn:hover{background:#6366f10d;color:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1)}.model-compare-wrapper.dark .select-btn.active{background:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1);color:#fff}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
1759
|
+
}
|
|
1760
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIModelCompareComponent, decorators: [{
|
|
1761
|
+
type: Component,
|
|
1762
|
+
args: [{ selector: 'ngx-ai-model-compare', standalone: true, imports: [CommonModule, FormsModule], template: `
|
|
1763
|
+
<div class="model-compare-wrapper" [class.dark]="theme() === 'dark'">
|
|
1764
|
+
<!-- Toolbar Filter Bar -->
|
|
1765
|
+
<div class="toolbar-header">
|
|
1766
|
+
<div class="search-box">
|
|
1767
|
+
<span class="search-icon">🔍</span>
|
|
1768
|
+
<input
|
|
1769
|
+
type="text"
|
|
1770
|
+
[ngModel]="searchQuery()"
|
|
1771
|
+
(ngModelChange)="searchQuery.set($event)"
|
|
1772
|
+
placeholder="Search model or provider..."
|
|
1773
|
+
class="filter-input"
|
|
1774
|
+
/>
|
|
1775
|
+
</div>
|
|
1776
|
+
|
|
1777
|
+
<!-- Filter Tags -->
|
|
1778
|
+
<div class="filter-tags">
|
|
1779
|
+
@for (tag of tags; track tag.value) {
|
|
1780
|
+
<button
|
|
1781
|
+
class="tag-btn"
|
|
1782
|
+
[class.active]="activeTag() === tag.value"
|
|
1783
|
+
(click)="activeTag.set(tag.value)"
|
|
1784
|
+
>
|
|
1785
|
+
{{ tag.label }}
|
|
1786
|
+
</button>
|
|
1787
|
+
}
|
|
1788
|
+
</div>
|
|
1789
|
+
</div>
|
|
1790
|
+
|
|
1791
|
+
<!-- Comparison Grid Container -->
|
|
1792
|
+
<div class="table-container">
|
|
1793
|
+
<table class="compare-table">
|
|
1794
|
+
<thead>
|
|
1795
|
+
<tr>
|
|
1796
|
+
<th class="cell-model">Model</th>
|
|
1797
|
+
<th>Parameters</th>
|
|
1798
|
+
<th>Context</th>
|
|
1799
|
+
<th>Cost (In/Out per 1M)</th>
|
|
1800
|
+
<th class="cell-latency">Latency</th>
|
|
1801
|
+
<th>Capabilities</th>
|
|
1802
|
+
<th>Rating</th>
|
|
1803
|
+
<th class="cell-action">Action</th>
|
|
1804
|
+
</tr>
|
|
1805
|
+
</thead>
|
|
1806
|
+
<tbody>
|
|
1807
|
+
@if (filteredModels().length === 0) {
|
|
1808
|
+
<tr>
|
|
1809
|
+
<td colspan="8" class="empty-state">
|
|
1810
|
+
No models match the current filter or search criteria.
|
|
1811
|
+
</td>
|
|
1812
|
+
</tr>
|
|
1813
|
+
} @else {
|
|
1814
|
+
@for (model of filteredModels(); track model.name) {
|
|
1815
|
+
<tr
|
|
1816
|
+
class="model-row"
|
|
1817
|
+
[class.recommended]="model.recommended"
|
|
1818
|
+
[class.selected]="selectedModel()?.name === model.name"
|
|
1819
|
+
(click)="selectModel(model)"
|
|
1820
|
+
>
|
|
1821
|
+
<!-- Model Info -->
|
|
1822
|
+
<td class="cell-model">
|
|
1823
|
+
<div class="model-title-wrap">
|
|
1824
|
+
<div class="model-name">
|
|
1825
|
+
{{ model.name }}
|
|
1826
|
+
<span *ngIf="model.recommended" class="badge-recommended">Rec</span>
|
|
1827
|
+
<span *ngIf="model.status === 'beta'" class="badge-beta">Beta</span>
|
|
1828
|
+
</div>
|
|
1829
|
+
<div class="model-provider">{{ model.provider }}</div>
|
|
1830
|
+
</div>
|
|
1831
|
+
</td>
|
|
1832
|
+
|
|
1833
|
+
<!-- Parameters -->
|
|
1834
|
+
<td>
|
|
1835
|
+
<span class="param-tag">{{ model.parameters }}</span>
|
|
1836
|
+
</td>
|
|
1837
|
+
|
|
1838
|
+
<!-- Context Window -->
|
|
1839
|
+
<td>{{ model.contextWindow }}</td>
|
|
1840
|
+
|
|
1841
|
+
<!-- Pricing -->
|
|
1842
|
+
<td>
|
|
1843
|
+
<div class="pricing-wrap">
|
|
1844
|
+
<span class="price-val">\${{ model.pricingInput }}</span>
|
|
1845
|
+
<span class="price-slash">/</span>
|
|
1846
|
+
<span class="price-val">\${{ model.pricingOutput }}</span>
|
|
1847
|
+
</div>
|
|
1848
|
+
</td>
|
|
1849
|
+
|
|
1850
|
+
<!-- Latency Bar -->
|
|
1851
|
+
<td class="cell-latency">
|
|
1852
|
+
<div class="latency-graph-wrap">
|
|
1853
|
+
<div class="latency-metrics">
|
|
1854
|
+
<span>{{ model.avgLatency }}s</span>
|
|
1855
|
+
</div>
|
|
1856
|
+
<div class="bar-track">
|
|
1857
|
+
<div
|
|
1858
|
+
class="bar-fill"
|
|
1859
|
+
[style.width.%]="getLatencyPercentage(model.avgLatency)"
|
|
1860
|
+
[class.fast]="model.avgLatency <= 1.0"
|
|
1861
|
+
[class.moderate]="model.avgLatency > 1.0 && model.avgLatency <= 2.2"
|
|
1862
|
+
[class.slow]="model.avgLatency > 2.2"
|
|
1863
|
+
></div>
|
|
1864
|
+
</div>
|
|
1865
|
+
</div>
|
|
1866
|
+
</td>
|
|
1867
|
+
|
|
1868
|
+
<!-- Capabilities -->
|
|
1869
|
+
<td>
|
|
1870
|
+
<div class="capabilities-icons">
|
|
1871
|
+
<span [class.active]="model.capabilities.includes('text')" title="Text processing">💬</span>
|
|
1872
|
+
<span [class.active]="model.capabilities.includes('code')" title="Code generation">💻</span>
|
|
1873
|
+
<span [class.active]="model.capabilities.includes('vision')" title="Computer vision">👁️</span>
|
|
1874
|
+
<span [class.active]="model.capabilities.includes('audio')" title="Voice/Audio input">🎙️</span>
|
|
1875
|
+
</div>
|
|
1876
|
+
</td>
|
|
1877
|
+
|
|
1878
|
+
<!-- Rating -->
|
|
1879
|
+
<td>
|
|
1880
|
+
<div class="rating-stars" [title]="model.rating + ' stars'">
|
|
1881
|
+
@for (star of [1, 2, 3, 4, 5]; track star) {
|
|
1882
|
+
<span class="star" [class.filled]="star <= model.rating">★</span>
|
|
1883
|
+
}
|
|
1884
|
+
</div>
|
|
1885
|
+
</td>
|
|
1886
|
+
|
|
1887
|
+
<!-- Select Button -->
|
|
1888
|
+
<td class="cell-action" (click)="$event.stopPropagation()">
|
|
1889
|
+
<button
|
|
1890
|
+
class="select-btn"
|
|
1891
|
+
[class.active]="selectedModel()?.name === model.name"
|
|
1892
|
+
(click)="selectModel(model)"
|
|
1893
|
+
>
|
|
1894
|
+
{{ selectedModel()?.name === model.name ? 'Selected' : 'Compare' }}
|
|
1895
|
+
</button>
|
|
1896
|
+
</td>
|
|
1897
|
+
</tr>
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
</tbody>
|
|
1901
|
+
</table>
|
|
1902
|
+
</div>
|
|
1903
|
+
</div>
|
|
1904
|
+
`, styles: [":host{display:block;width:100%}.model-compare-wrapper{background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-md, 10px);box-shadow:var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .08));overflow:hidden;display:flex;flex-direction:column;transition:all .3s}.toolbar-header{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid var(--border-color, #e2e8f0);gap:16px;flex-wrap:wrap}.search-box{display:flex;align-items:center;gap:8px;border:1px solid var(--border-color, #e2e8f0);border-radius:var(--radius-sm, 6px);padding:6px 12px;background:var(--bg-primary, #f8fafc);min-width:250px;flex:1;max-width:400px}.search-icon{font-size:14px}.filter-input{border:none;background:transparent;outline:none;font-size:13px;width:100%;color:var(--text-primary, #0f172a)}.filter-tags{display:flex;gap:8px;overflow-x:auto;padding-bottom:2px}.tag-btn{padding:6px 12px;font-size:12px;font-weight:600;border-radius:9999px;border:1px solid var(--border-color, #e2e8f0);background:transparent;color:var(--text-secondary, #475569);cursor:pointer;font-family:var(--ngx-font-family, sans-serif);transition:all .2s}.tag-btn:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.tag-btn.active{background:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5);color:#fff}.table-container{overflow-x:auto}.compare-table{width:100%;border-collapse:collapse;text-align:left;font-family:var(--ngx-font-family, sans-serif);font-size:13px}.compare-table th{padding:14px 20px;font-weight:700;color:var(--text-secondary, #475569);background:var(--border-light, #f1f5f9);border-bottom:1px solid var(--border-color, #e2e8f0);-webkit-user-select:none;user-select:none}.compare-table td{padding:16px 20px;border-bottom:1px solid var(--border-light, #f1f5f9);vertical-align:middle;color:var(--text-primary, #0f172a);transition:background .15s}.model-row{cursor:pointer}.model-row:hover td{background:#4f46e505}.model-row.selected td{background:#4f46e50d}.model-row.recommended{position:relative}.model-title-wrap{display:flex;flex-direction:column;gap:2px}.model-name{font-weight:700;display:flex;align-items:center;gap:6px}.model-provider{font-size:11px;color:var(--text-secondary, #475569)}.badge-recommended{background:#e0e7ff;color:#4f46e5;font-size:10px;padding:1px 6px;border-radius:4px;font-weight:700}.badge-beta{background:#fef3c7;color:#d97706;font-size:10px;padding:1px 6px;border-radius:4px;font-weight:700}.param-tag{background:var(--border-light, #f1f5f9);color:var(--text-secondary, #475569);padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600}.pricing-wrap{display:flex;align-items:center;font-weight:600}.price-slash{color:var(--text-muted, #94a3b8);margin:0 4px}.latency-graph-wrap{display:flex;flex-direction:column;gap:6px;width:100px}.latency-metrics{display:flex;justify-content:space-between;font-size:11px;font-weight:600;color:var(--text-secondary, #475569)}.bar-track{height:6px;background:var(--border-color, #e2e8f0);border-radius:3px;overflow:hidden}.bar-fill{height:100%;border-radius:3px}.bar-fill.fast{background:#10b981}.bar-fill.moderate{background:#f59e0b}.bar-fill.slow{background:#ef4444}.capabilities-icons{display:flex;gap:6px;font-size:15px}.capabilities-icons span{opacity:.2;filter:grayscale(1);transition:opacity .2s}.capabilities-icons span.active{opacity:1;filter:none}.rating-stars{color:#f59e0b;font-size:14px;letter-spacing:-2px;white-space:nowrap}.star{opacity:.2}.star.filled{opacity:1}.select-btn{padding:6px 12px;font-size:11px;font-weight:700;border-radius:6px;border:1px solid var(--border-color, #e2e8f0);background:transparent;color:var(--text-secondary, #475569);cursor:pointer;font-family:var(--ngx-font-family, sans-serif);transition:all .2s;width:76px}.select-btn:hover{background:#4f46e50d;color:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5)}.select-btn.active{background:var(--primary-color, #4f46e5);border-color:var(--primary-color, #4f46e5);color:#fff}.empty-state{text-align:center;padding:30px!important;color:var(--text-secondary, #475569);font-style:italic}.model-compare-wrapper.dark{background:#0f172a;border-color:#1f2937}.model-compare-wrapper.dark .toolbar-header{border-bottom-color:#1f2937}.model-compare-wrapper.dark .search-box{border-color:#1f2937;background:#0b0f19}.model-compare-wrapper.dark .filter-input{color:#f8fafc}.model-compare-wrapper.dark .tag-btn{border-color:#374151;color:#94a3b8}.model-compare-wrapper.dark .tag-btn:hover{background:#1f2937;color:#f8fafc}.model-compare-wrapper.dark .tag-btn.active{background:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1);color:#fff}.model-compare-wrapper.dark .compare-table th{background:#1e293b;border-bottom-color:#1f2937;color:#94a3b8}.model-compare-wrapper.dark .compare-table td{border-bottom-color:#1f2937;color:#e2e8f0}.model-compare-wrapper.dark .model-row:hover td{background:#6366f105}.model-compare-wrapper.dark .model-row.selected td{background:#6366f10d}.model-compare-wrapper.dark .badge-recommended{background:#6366f126;color:#818cf8}.model-compare-wrapper.dark .badge-beta{background:#f59e0b26;color:#fbbf24}.model-compare-wrapper.dark .param-tag{background:#1e293b;color:#94a3b8}.model-compare-wrapper.dark .model-provider{color:#6b7280}.model-compare-wrapper.dark .bar-track{background:#1f2937}.model-compare-wrapper.dark .latency-metrics{color:#94a3b8}.model-compare-wrapper.dark .select-btn{border-color:#374151;color:#94a3b8}.model-compare-wrapper.dark .select-btn:hover{background:#6366f10d;color:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1)}.model-compare-wrapper.dark .select-btn.active{background:var(--primary-color, #6366f1);border-color:var(--primary-color, #6366f1);color:#fff}\n"] }]
|
|
1905
|
+
}] });
|
|
1906
|
+
|
|
491
1907
|
/**
|
|
492
1908
|
* Generated bundle index. Do not edit.
|
|
493
1909
|
*/
|
|
494
1910
|
|
|
495
|
-
export { AIChatComponent };
|
|
1911
|
+
export { AIAudioWaveComponent, AIChatComponent, AIChatWidgetComponent, AICodeEditorComponent, AIModelCompareComponent, AIPromptEditorComponent };
|
|
496
1912
|
//# sourceMappingURL=ngx-core-components-ai.mjs.map
|