mcp-web-ui
Version:
Ultra-lightweight vanilla JavaScript framework for MCP servers - Zero dependencies, perfect security, 2-3KB bundle size
1,274 lines (1,076 loc) • 22.1 kB
CSS
/* MCP Web UI Styles */
* {
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f8fafc;
color: #334155;
line-height: 1.6;
}
/* Header */
.header {
background: white;
border-bottom: 1px solid #e2e8f0;
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.header h1 {
margin: 0;
color: #1e293b;
font-size: 1.5rem;
font-weight: 600;
}
.session-info {
display: flex;
align-items: center;
gap: 1rem;
font-size: 0.875rem;
color: #64748b;
}
.btn-extend {
background: #3b82f6;
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
cursor: pointer;
font-size: 0.875rem;
font-weight: 500;
transition: background-color 0.2s;
}
.btn-extend:hover {
background: #2563eb;
}
/* Main content */
.main {
padding: 2rem;
max-width: 1200px;
margin: 0 auto;
}
/* Loading state */
.loading {
text-align: center;
padding: 2rem;
color: #64748b;
font-size: 1.125rem;
}
/* Components */
.component {
background: white;
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
margin-bottom: 2rem;
overflow: hidden;
}
.component h2 {
margin: 0;
padding: 1.5rem 2rem;
background: #f8fafc;
border-bottom: 1px solid #e2e8f0;
font-size: 1.25rem;
font-weight: 600;
color: #1e293b;
}
/* List component */
.list-container {
padding: 1rem;
}
.list-item {
display: flex;
align-items: flex-start;
padding: 0.75rem;
border-bottom: 1px solid #f1f5f9;
transition: all 0.3s ease;
opacity: 1;
transform: translateY(0);
}
.list-item:last-child {
border-bottom: none;
}
.list-item:hover {
background-color: #f8fafc;
}
/* Smooth animations for item state changes */
.list-item.item-completing {
opacity: 0.6;
transform: scale(0.98);
}
.list-item.item-removing {
opacity: 0;
transform: translateX(-100%);
max-height: 0;
padding-top: 0;
padding-bottom: 0;
margin-bottom: 0;
overflow: hidden;
}
/* Smooth checkbox transitions */
.list-item input[type="checkbox"] {
margin-right: 0.75rem;
margin-top: 0.125rem;
width: 1rem;
height: 1rem;
transition: transform 0.2s ease;
}
.list-item input[type="checkbox"]:checked {
transform: scale(1.1);
}
.item-content {
flex: 1;
cursor: pointer;
display: flex;
flex-direction: column;
gap: 0.25rem;
transition: all 0.3s ease;
}
.item-text {
font-weight: 500;
color: #1e293b;
transition: all 0.3s ease;
}
.list-item input[type="checkbox"]:checked+.item-content .item-text {
text-decoration: line-through;
color: #64748b;
opacity: 0.7;
}
.item-meta {
display: flex;
gap: 0.5rem;
font-size: 0.75rem;
color: #64748b;
}
.item-meta span {
background: #f1f5f9;
padding: 0.125rem 0.375rem;
border-radius: 0.25rem;
}
/* Priority badges */
.priority-low {
background: #dcfce7 ;
color: #166534 ;
}
.priority-medium {
background: #fef3c7 ;
color: #92400e ;
}
.priority-high {
background: #fed7d7 ;
color: #c53030 ;
}
.priority-urgent {
background: #fee2e2 ;
color: #dc2626 ;
font-weight: 600;
}
/* Stats */
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin-bottom: 2rem;
}
.stat-card {
background: white;
padding: 1.5rem;
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
text-align: center;
}
.stat-card h3 {
margin: 0 0 0.5rem 0;
font-size: 2rem;
font-weight: 700;
color: #3b82f6;
}
.stat-card p {
margin: 0;
color: #64748b;
font-size: 0.875rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
/* Responsive design */
@media (max-width: 768px) {
.header {
padding: 1rem;
flex-direction: column;
gap: 1rem;
text-align: center;
}
.main {
padding: 1rem;
}
.component h2 {
padding: 1rem;
}
.list-container {
padding: 0.5rem;
}
.list-item {
padding: 0.5rem;
}
.session-info {
flex-direction: column;
gap: 0.5rem;
}
}
/* Accessibility */
@media (prefers-reduced-motion: reduce) {
* {
transition: none ;
}
}
/* Focus styles */
button:focus,
input:focus {
outline: 2px solid #3b82f6;
outline-offset: 2px;
}
/* Dark mode support (basic) */
@media (prefers-color-scheme: dark) {
body {
background-color: #0f172a;
color: #e2e8f0;
}
.header {
background: #1e293b;
border-bottom-color: #334155;
}
.header h1 {
color: #f1f5f9;
}
.component {
background: #1e293b;
}
.component h2 {
background: #334155;
color: #f1f5f9;
border-bottom-color: #475569;
}
.list-item:hover {
background-color: #334155;
}
.item-text {
color: #f1f5f9;
}
.item-meta span {
background: #334155;
color: #cbd5e1;
}
.stat-card {
background: #1e293b;
}
}
/* ========== NEW STYLES FOR ENHANCED TODOODLES UI ========== */
/* Add Todoodle Section */
.add-todoodle-section {
padding: 1.5rem 2rem;
border-bottom: 1px solid #e2e8f0;
background: #fefefe;
}
.btn-add-todo {
background: #10b981;
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 0.5rem;
cursor: pointer;
font-size: 0.875rem;
font-weight: 600;
transition: all 0.2s ease;
display: flex;
align-items: center;
gap: 0.5rem;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.btn-add-todo:hover {
background: #059669;
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.btn-add-todo.active {
background: #6b7280;
}
.btn-add-todo.active:hover {
background: #4b5563;
}
/* Add Form */
.add-form {
margin-top: 1rem;
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 0.5rem;
padding: 1.5rem;
}
.form-row {
margin-bottom: 1rem;
}
.form-row-secondary {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 1rem;
}
.form-group {
display: flex;
flex-direction: column;
}
.form-group label {
font-size: 0.875rem;
font-weight: 500;
color: #374151;
margin-bottom: 0.375rem;
}
.form-input {
border: 1px solid #d1d5db;
border-radius: 0.375rem;
padding: 0.75rem;
font-size: 0.875rem;
transition: all 0.2s ease;
background: white;
}
.form-input:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-input-main {
font-size: 1rem;
padding: 1rem;
font-weight: 500;
}
.form-input-small {
font-size: 0.875rem;
}
.form-actions {
display: flex;
gap: 0.75rem;
margin-top: 1.5rem;
}
.btn-submit {
background: #3b82f6;
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
cursor: pointer;
font-size: 0.875rem;
font-weight: 600;
transition: all 0.2s ease;
}
.btn-submit:hover:not(:disabled) {
background: #2563eb;
transform: translateY(-1px);
}
.btn-submit:disabled {
background: #9ca3af;
cursor: not-allowed;
transform: none;
}
.btn-cancel {
background: transparent;
color: #6b7280;
border: 1px solid #d1d5db;
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
cursor: pointer;
font-size: 0.875rem;
font-weight: 500;
transition: all 0.2s ease;
}
.btn-cancel:hover {
background: #f9fafb;
border-color: #9ca3af;
}
/* Enhanced List Items */
.list-item {
display: flex;
align-items: flex-start;
padding: 1rem 0.75rem;
border-bottom: 1px solid #f1f5f9;
transition: all 0.3s ease;
border-radius: 0.375rem;
margin-bottom: 0.5rem;
}
.list-item:last-child {
border-bottom: none;
margin-bottom: 0;
}
.list-item:hover {
background-color: #f8fafc;
border-color: #e2e8f0;
}
.list-item.completed {
opacity: 0.7;
background-color: #f8fafc;
}
.list-item.temp-item {
opacity: 0.8;
background: linear-gradient(90deg, #f0f9ff, #fefefe);
border-left: 3px solid #3b82f6;
}
.item-checkbox {
margin-right: 0.75rem;
margin-top: 0.125rem;
}
.item-checkbox input[type="checkbox"] {
width: 1.125rem;
height: 1.125rem;
cursor: pointer;
transition: transform 0.2s ease;
}
.item-checkbox input[type="checkbox"]:checked {
transform: scale(1.1);
}
.item-content {
flex: 1;
min-width: 0;
}
.item-main {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.item-text {
font-weight: 500;
color: #1e293b;
cursor: pointer;
font-size: 0.95rem;
line-height: 1.4;
transition: all 0.3s ease;
}
.list-item.completed .item-text {
text-decoration: line-through;
color: #64748b;
}
.item-meta {
display: flex;
flex-wrap: wrap;
gap: 0.375rem;
}
/* Enhanced Badges */
.badge {
font-size: 0.75rem;
font-weight: 500;
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
white-space: nowrap;
}
.badge-category {
background: #ede9fe;
color: #6d28d9;
}
.badge-priority {
font-weight: 600;
}
.badge-priority.priority-low {
background: #dcfce7;
color: #166534;
}
.badge-priority.priority-medium {
background: #fef3c7;
color: #92400e;
}
.badge-priority.priority-high {
background: #fed7d7;
color: #c53030;
}
.badge-priority.priority-urgent {
background: #fee2e2;
color: #dc2626;
animation: pulse-urgent 2s infinite;
}
@keyframes pulse-urgent {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.8;
}
}
.badge-due {
background: #fef2f2;
color: #b91c1c;
}
/* Item Actions */
.item-actions {
margin-left: 0.75rem;
opacity: 0;
transition: opacity 0.2s ease;
}
.list-item:hover .item-actions {
opacity: 1;
}
.btn-delete {
background: transparent;
color: #ef4444;
border: none;
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
cursor: pointer;
font-size: 1.125rem;
font-weight: 600;
line-height: 1;
transition: all 0.2s ease;
width: 1.5rem;
height: 1.5rem;
display: flex;
align-items: center;
justify-content: center;
}
.btn-delete:hover {
background: #fee2e2;
color: #dc2626;
}
/* Empty State */
.empty-state {
text-align: center;
padding: 3rem 2rem;
color: #64748b;
}
.empty-state p {
font-size: 1rem;
margin: 0;
}
/* Alpine.js Transitions */
[x-cloak] {
display: none ;
}
/* Mobile Responsiveness for New Elements */
@media (max-width: 768px) {
.add-todoodle-section {
padding: 1rem;
}
.add-form {
padding: 1rem;
}
.form-row-secondary {
grid-template-columns: 1fr;
gap: 0.75rem;
}
.form-actions {
flex-direction: column;
}
.btn-submit,
.btn-cancel {
width: 100%;
justify-content: center;
}
.list-item {
padding: 0.75rem 0.5rem;
}
.item-meta {
gap: 0.25rem;
}
.badge {
font-size: 0.7rem;
padding: 0.125rem 0.375rem;
}
.item-actions {
opacity: 1;
/* Always show on mobile */
}
}
/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
.add-todoodle-section {
background: #1f2937;
border-color: #374151;
}
.add-form {
background: #111827;
border-color: #374151;
}
.form-group label {
color: #d1d5db;
}
.form-input {
background: #1f2937;
border-color: #4b5563;
color: #f3f4f6;
}
.form-input:focus {
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.btn-cancel {
color: #9ca3af;
border-color: #4b5563;
}
.btn-cancel:hover {
background: #1f2937;
border-color: #6b7280;
}
.list-item.temp-item {
background: linear-gradient(90deg, #1e3a8a, #1f2937);
border-left-color: #3b82f6;
}
.empty-state p {
color: #9ca3af;
}
}
/* ========== UNDO TOAST SYSTEM ========== */
/* Undo Container */
.undo-container {
position: fixed;
bottom: 2rem;
right: 2rem;
z-index: 1000;
display: flex;
flex-direction: column;
gap: 0.75rem;
max-width: 400px;
}
/* Undo Toast */
.undo-toast {
background: #1f2937;
color: white;
border-radius: 0.5rem;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
overflow: hidden;
border: 1px solid #374151;
position: relative;
animation: slideInRight 0.3s ease-out;
}
@keyframes slideInRight {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
/* Undo Content */
.undo-content {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem 1.25rem;
gap: 1rem;
}
.undo-message {
font-size: 0.875rem;
font-weight: 500;
color: #e5e7eb;
display: flex;
align-items: center;
gap: 0.5rem;
}
.undo-button {
background: #3b82f6;
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
cursor: pointer;
font-size: 0.875rem;
font-weight: 600;
transition: all 0.2s ease;
text-transform: uppercase;
letter-spacing: 0.025em;
}
.undo-button:hover {
background: #2563eb;
transform: translateY(-1px);
}
/* Progress Bar */
.undo-progress {
height: 3px;
background: #374151;
position: relative;
overflow: hidden;
}
.undo-progress-bar {
height: 100%;
background: linear-gradient(90deg, #3b82f6, #1d4ed8);
width: 0%;
animation: undoProgress 5s linear forwards;
position: relative;
}
@keyframes undoProgress {
from {
width: 100%;
}
to {
width: 0%;
}
}
/* Add a subtle glow effect */
.undo-progress-bar::after {
content: '';
position: absolute;
top: 0;
right: 0;
width: 20px;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
animation: progressGlow 1s ease-in-out infinite alternate;
}
@keyframes progressGlow {
from {
opacity: 0.3;
}
to {
opacity: 0.7;
}
}
/* Mobile Responsiveness for Undo Toast */
@media (max-width: 768px) {
.undo-container {
bottom: 1rem;
right: 1rem;
left: 1rem;
max-width: none;
}
.undo-content {
padding: 0.875rem 1rem;
gap: 0.75rem;
}
.undo-message {
font-size: 0.8rem;
}
.undo-button {
padding: 0.5rem 0.875rem;
font-size: 0.8rem;
}
}
/* Dark Mode Undo Toast */
@media (prefers-color-scheme: dark) {
.undo-toast {
background: #111827;
border-color: #1f2937;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}
.undo-message {
color: #f3f4f6;
}
.undo-progress {
background: #1f2937;
}
}
/* Fade out animation when removing */
.undo-toast[x-transition\:leave] {
animation: slideOutRight 0.3s ease-in forwards;
}
@keyframes slideOutRight {
from {
transform: translateX(0);
opacity: 1;
}
to {
transform: translateX(100%);
opacity: 0;
}
}
/* ========== VANILLA JS FRAMEWORK STYLES ========== */
/* Stats Component */
.component-stats .stats-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.5rem 2rem;
background: #f8fafc;
border-bottom: 1px solid #e2e8f0;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1.5rem;
padding: 2rem;
}
.stats-horizontal {
display: flex;
gap: 1.5rem;
padding: 2rem;
overflow-x: auto;
}
.stat-card {
background: white;
border-radius: 0.5rem;
padding: 1.5rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
cursor: pointer;
border-left: 4px solid #e2e8f0;
}
.stat-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.stat-card.stat-blue {
border-left-color: #3b82f6;
}
.stat-card.stat-green {
border-left-color: #10b981;
}
.stat-card.stat-yellow {
border-left-color: #f59e0b;
}
.stat-card.stat-red {
border-left-color: #ef4444;
}
.stat-card-content {
display: flex;
align-items: center;
gap: 1rem;
}
.stat-icon {
font-size: 2rem;
opacity: 0.8;
}
.stat-details {
flex: 1;
}
.stat-value {
font-size: 2rem;
font-weight: 700;
color: #1e293b;
line-height: 1;
}
.stat-label {
font-size: 0.875rem;
color: #64748b;
margin-top: 0.25rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.stat-trend {
display: flex;
align-items: center;
gap: 0.25rem;
margin-top: 0.5rem;
font-size: 0.75rem;
font-weight: 500;
}
.stat-trend.trend-up {
color: #10b981;
}
.stat-trend.trend-down {
color: #ef4444;
}
.stat-trend.trend-neutral {
color: #64748b;
}
.stat-description {
margin-top: 1rem;
padding-top: 1rem;
border-top: 1px solid #f1f5f9;
font-size: 0.875rem;
color: #64748b;
}
.btn-refresh-stats {
background: transparent;
border: 1px solid #d1d5db;
color: #6b7280;
padding: 0.5rem;
border-radius: 0.375rem;
cursor: pointer;
transition: all 0.2s ease;
width: 2rem;
height: 2rem;
display: flex;
align-items: center;
justify-content: center;
}
.btn-refresh-stats:hover {
background: #f9fafb;
border-color: #9ca3af;
transform: rotate(180deg);
}
/* Table Component Enhanced Styles */
.component-table .table-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.5rem 2rem;
background: #f8fafc;
border-bottom: 1px solid #e2e8f0;
}
.table-controls {
display: flex;
gap: 0.5rem;
}
.btn-export,
.btn-refresh {
background: transparent;
border: 1px solid #d1d5db;
color: #6b7280;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
cursor: pointer;
font-size: 0.875rem;
transition: all 0.2s ease;
}
.btn-export:hover,
.btn-refresh:hover {
background: #f9fafb;
border-color: #9ca3af;
}
.table-filters {
padding: 1rem 2rem;
background: #fefefe;
border-bottom: 1px solid #f1f5f9;
}
.filter-search {
position: relative;
max-width: 400px;
}
.filter-input {
width: 100%;
padding: 0.75rem;
border: 1px solid #d1d5db;
border-radius: 0.375rem;
font-size: 0.875rem;
transition: border-color 0.2s ease;
}
.filter-input:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.btn-clear-filter {
position: absolute;
right: 0.5rem;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
color: #9ca3af;
cursor: pointer;
font-size: 1.25rem;
padding: 0.25rem;
}
.table-pagination {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 2rem;
background: #f8fafc;
border-top: 1px solid #e2e8f0;
}
.pagination-controls {
display: flex;
gap: 0.25rem;
}
.btn-page {
background: white;
border: 1px solid #d1d5db;
color: #374151;
padding: 0.5rem 0.75rem;
border-radius: 0.375rem;
cursor: pointer;
font-size: 0.875rem;
transition: all 0.2s ease;
}
.btn-page:hover:not(:disabled) {
background: #f9fafb;
border-color: #9ca3af;
}
.btn-page:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.btn-page.current {
background: #3b82f6;
color: white;
border-color: #3b82f6;
}
.table-empty {
text-align: center;
padding: 4rem 2rem;
color: #64748b;
}
.empty-icon {
font-size: 3rem;
margin-bottom: 1rem;
}
.bulk-actions {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 2rem;
background: #fffbeb;
border-top: 1px solid #fbbf24;
}
.bulk-controls {
display: flex;
gap: 0.5rem;
}
.btn-bulk {
background: white;
border: 1px solid #d1d5db;
color: #374151;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
cursor: pointer;
font-size: 0.875rem;
transition: all 0.2s ease;
}
.btn-bulk:hover {
background: #f9fafb;
}
/* Component loading states */
.table-loading {
display: flex;
align-items: center;
justify-content: center;
padding: 4rem 2rem;
color: #64748b;
}
.loading-spinner {
width: 2rem;
height: 2rem;
border: 3px solid #f3f3f3;
border-top: 3px solid #3b82f6;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-right: 1rem;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* Mobile responsive styles for vanilla JS components */
@media (max-width: 768px) {
.stats-grid {
grid-template-columns: 1fr;
gap: 1rem;
padding: 1rem;
}
.stats-horizontal {
flex-direction: column;
padding: 1rem;
}
.stat-card {
padding: 1rem;
}
.component-table .table-header {
flex-direction: column;
gap: 1rem;
align-items: flex-start;
}
.table-controls {
width: 100%;
justify-content: flex-end;
}
.table-pagination {
flex-direction: column;
gap: 1rem;
}
.pagination-controls {
flex-wrap: wrap;
justify-content: center;
}
}