ttc-ai-client
Version:
TypeScript client sdk for TTC AI services with decorators and schema validation.
558 lines (494 loc) • 10.7 kB
JavaScript
"use strict";
/**
* TTC Chat Widget Styles
* Exported as TypeScript string for proper bundling
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.widgetStyles = void 0;
exports.widgetStyles = `
:root {
--ttc-primary: #565656ff;
--ttc-primary-hover: #2d2d2dff;
--ttc-bg: #f9fafb;
--ttc-messages-bg: #f9fafb;
--ttc-header-bg: #f9fafb;
--ttc-footer-bg: #ffffff;
--ttc-text: #1f2937;
--ttc-header-text: #1f2937;
--ttc-user-bubble: var(--ttc-primary);
--ttc-ai-bubble: #e5e7eb;
--ttc-user-bubble-text: #ffffff;
--ttc-ai-bubble-text: var(--ttc-text);
--ttc-status-text: #6b7280;
--ttc-border: #cdced1ff;
--ttc-scrollbar: #d1d5db;
--ttc-focus: var(--ttc-primary);
--ttc-radius: 14px;
--ttc-shadow: 0 8px 32px rgba(0,0,0,0.15);
--ttc-font: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
--ttc-bot-border: var(--ttc-primary);
--ttc-bot-bg: #ffffff;
--ttc-bot-eye: var(--ttc-primary);
--ttc-bot-antenna: var(--ttc-primary);
}
/* TTC Animated Bot Widget */
.ttc-bot-container {
position: fixed;
bottom: 20px;
right: 20px;
width: 56px;
height: 56px;
z-index: 9999;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.ttc-bot-container.ttc-bot-moved {
bottom: 20px;
right: 380px;
transform: translateX(-50%);
}
/* Floating Bot Button */
.ttc-floating-bot {
width: 56px;
height: 56px;
cursor: pointer;
position: relative;
display: flex;
align-items: center;
justify-content: center;
border: none;
outline: none;
animation: ttc-bot-float 4s ease-in-out infinite;
}
.ttc-floating-bot:hover {
/* No hover effects for minimalist design */
}
.ttc-floating-bot:active {
/* No active effects for minimalist design */
}
.ttc-floating-bot:focus {
outline: none;
}
/* New SVG-based Bot Styles */
.bot-container {
display: inline-block;
margin-top: calc(56px * 0.4);
transition: transform var(--transition-speed) ease;
transform: rotate(var(--bot-tilt, 0deg));
}
.bot-body {
position: relative;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
transform-origin: center center;
will-change: transform;
}
.bot-svg {
position: absolute;
top: 0;
left: 0;
z-index: 0;
}
/* Base styles for all SVG shapes */
.shape-path {
transition: all var(--transition-speed) ease;
}
.antenna-path {
transition: fill var(--transition-speed) ease;
fill: var(--bot-border-color);
}
.eyes-container {
display: flex;
gap: 25%;
width: 50%;
align-items: center;
justify-content: center;
z-index: 1;
transform: translate(var(--bot-eye-x, 0px), var(--bot-eye-y, 0px));
transition: transform 0.05s ease-out;
}
.eye {
width: 40%;
padding-bottom: 40%;
height: 0;
background: var(--bot-eye-color);
border-radius: 50%;
transition: background-color var(--transition-speed) ease;
}
/* Hover effects */
.bot-container:hover .shape-path {
stroke: var(--bot-primary-color);
}
.bot-container:hover .antenna-path {
fill: var(--bot-primary-color);
}
.bot-container:hover .eye {
background: var(--bot-primary-color);
}
/* Call Icon - Simplified and Clean */
.ttc-call-icon {
position: absolute;
top: -6px;
right: -6px;
width: 14px;
height: 14px;
background: #ef4444;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
transform: scale(0);
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
z-index: 1;
box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}
.ttc-floating-bot.ttc-call-active .ttc-call-icon {
opacity: 1;
transform: scale(1);
animation: ttc-call-glow 2s ease-in-out infinite;
}
/* Remove complex pseudo-elements, just a simple inner dot */
.ttc-call-icon::before {
content: '';
width: 6px;
height: 6px;
background: white;
border-radius: 50%;
position: relative;
}
/* Call Background Effects - Simplified */
.ttc-call-background {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 72px;
height: 72px;
pointer-events: none;
opacity: 0;
transition: opacity 0.4s ease;
}
.ttc-floating-bot.ttc-call-active .ttc-call-background {
opacity: 1;
}
.ttc-call-circle {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 1.5px solid rgba(239, 68, 68, 0.3);
border-radius: 50%;
animation: ttc-call-ripple 2s ease-out infinite;
}
.ttc-call-circle:nth-child(1) {
width: 56px;
height: 56px;
animation-delay: 0s;
}
.ttc-call-circle:nth-child(2) {
width: 64px;
height: 64px;
animation-delay: 0.5s;
}
.ttc-call-circle:nth-child(3) {
width: 72px;
height: 72px;
animation-delay: 1s;
}
/* Eyes Container */
.ttc-eyes-container {
display: flex;
gap: 6px;
align-items: center;
justify-content: center;
}
/* Robot Eyes */
.ttc-bot-eye {
width: 8px;
height: 8px;
background: #000000;
border-radius: 50%;
position: relative;
transition: transform 0.05s ease-out;
}
.ttc-floating-bot:hover .ttc-bot-eye {
/* Remove color change, keep original black */
}
/* Single Antenna */
.ttc-bot-antenna {
position: absolute;
top: -15px;
right: 6px;
width: 3px;
height: 15px;
transform-origin: bottom center;
transition: transform 0.05s ease-out;
}
.ttc-bot-antenna-base {
width: 3px;
height: 15px;
background: #000000;
border-radius: 1px;
}
.ttc-floating-bot:hover .ttc-bot-antenna-base {
/* Remove color change, keep original black */
}
/* Chat Panel */
.ttc-chat-panel {
position: fixed;
bottom: 20px;
right: 20px;
width: 360px;
height: 520px;
display: flex;
flex-direction: column;
background: var(--ttc-bg);
border: 1px solid var(--ttc-border);
border-radius: var(--ttc-radius);
box-shadow: var(--ttc-shadow);
overflow: hidden;
z-index: 9998;
font-family: var(--ttc-font);
transform: translateY(100%) scale(0.8);
opacity: 0;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.ttc-chat-panel.ttc-panel-visible {
transform: translateY(0) scale(1);
opacity: 1;
}
.ttc-hidden {
display: none !important;
}
/* Chat Header */
.ttc-chat-header {
padding: 12px 16px;
background: var(--ttc-header-bg);
color: var(--ttc-header-text);
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid var(--ttc-border);
}
.ttc-chat-header h4 {
margin: 0;
font-size: 15px;
font-weight: 600;
}
.ttc-chat-actions {
display: flex;
align-items: center;
gap: 8px;
}
.ttc-chat-clear,
.ttc-chat-reset,
.ttc-chat-close {
background: none;
border: none;
cursor: pointer;
font-size: 16px;
line-height: 1;
padding: 4px;
border-radius: 4px;
color: var(--ttc-header-text);
opacity: 0.7;
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
position: relative;
}
.ttc-chat-clear:hover,
.ttc-chat-reset:hover,
.ttc-chat-close:hover {
opacity: 1;
background: rgba(0, 0, 0, 0.1);
}
.ttc-chat-clear:hover::after,
.ttc-chat-reset:hover::after,
.ttc-chat-close:hover::after {
content: attr(data-tooltip);
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
background: white;
color: var(--ttc-text);
padding: 6px 8px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
white-space: nowrap;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
border: 1px solid var(--ttc-border);
z-index: 10000;
margin-top: 4px;
opacity: 1;
pointer-events: none;
}
.ttc-chat-clear:hover::before,
.ttc-chat-reset:hover::before,
.ttc-chat-close:hover::before {
content: '';
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
border: 4px solid transparent;
border-bottom-color: white;
margin-top: -1px;
z-index: 10001;
pointer-events: none;
}
.ttc-chat-clear:active,
.ttc-chat-reset:active,
.ttc-chat-close:active {
transform: scale(0.95);
}
.ttc-chat-clear svg,
.ttc-chat-reset svg {
width: 14px;
height: 14px;
stroke: currentColor;
transition: stroke 0.2s ease;
}
/* Chat Messages */
.ttc-chat-messages {
flex: 1;
padding: 12px;
overflow-y: auto;
display: flex;
flex-direction: column-reverse;
background: var(--ttc-messages-bg);
}
.ttc-chat-messages::-webkit-scrollbar {
width: 8px;
}
.ttc-chat-messages::-webkit-scrollbar-thumb {
background: var(--ttc-scrollbar);
border-radius: 4px;
}
.ttc-msg {
margin-bottom: 12px;
display: flex;
}
.ttc-msg-user {
justify-content: flex-end;
flex-direction: row-reverse;
}
.ttc-msg:last-child {
margin-bottom: 0;
}
.ttc-bubble {
max-width: 75%;
padding: 8px 12px;
border-radius: 18px;
font-size: 14px;
line-height: 1.4;
position: relative;
word-wrap: break-word;
white-space: pre-wrap;
}
.ttc-bubble-user {
background: var(--ttc-user-bubble);
color: var(--ttc-user-bubble-text);
border-bottom-right-radius: 4px;
}
.ttc-bubble-ai {
background: var(--ttc-ai-bubble);
color: var(--ttc-ai-bubble-text);
border-bottom-left-radius: 4px;
}
/* Chat Footer */
.ttc-chat-footer {
position: relative;
padding: 10px;
border-top: 1px solid var(--ttc-border);
background: var(--ttc-footer-bg);
}
.ttc-chat-status {
font-size: 12px;
color: var(--ttc-status-text);
text-align: center;
margin-bottom: 8px;
font-weight: 500;
opacity: 0.8;
}
.ttc-chat-form {
display: flex;
gap: 8px;
}
.ttc-input {
flex: 1;
padding: 10px 12px;
border: 1px solid var(--ttc-border);
border-radius: 20px;
font-size: 14px;
outline: none;
}
.ttc-input:focus {
border-color: var(--ttc-focus);
box-shadow: 0 0 0 2px rgba(79,70,229,.15);
}
/* Animations */
@keyframes ttc-bot-float {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-6px);
}
}
@keyframes ttc-call-glow {
0%, 100% {
transform: scale(1);
box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}
50% {
transform: scale(1.1);
box-shadow: 0 4px 16px rgba(239, 68, 68, 0.6);
}
}
@keyframes ttc-call-ripple {
0% {
transform: translate(-50%, -50%) scale(0.8);
opacity: 0.8;
}
100% {
transform: translate(-50%, -50%) scale(1.2);
opacity: 0;
}
}
@keyframes ttc-bot-jump {
0%, 100% {
transform: translateY(0) scale(1);
}
25% {
transform: translateY(-8px) scale(1.05);
}
50% {
transform: translateY(-4px) scale(1.02);
}
75% {
transform: translateY(-10px) scale(1.08);
}
}
/* Responsive */
@media (max-width: 480px) {
.ttc-bot-container.ttc-bot-moved {
right: 20px;
transform: none;
}
.ttc-chat-panel {
right: 20px;
left: 20px;
width: auto;
}
}
`;
//# sourceMappingURL=styles.js.map