668 lines
13 KiB
TypeScript
668 lines
13 KiB
TypeScript
import { css } from './plugins.js';
|
|
import type { CSSResult } from './plugins.js';
|
|
|
|
/**
|
|
* Modern professional theme for sw-dash components
|
|
* Inspired by Bloomberg terminals, Vercel dashboards, and shadcn/ui
|
|
*/
|
|
export const sharedStyles: CSSResult = css`
|
|
:host {
|
|
/* Neutral backgrounds - zinc scale */
|
|
--bg-primary: #09090b;
|
|
--bg-secondary: #18181b;
|
|
--bg-tertiary: #27272a;
|
|
--bg-elevated: #3f3f46;
|
|
|
|
/* Text colors */
|
|
--text-primary: #fafafa;
|
|
--text-secondary: #a1a1aa;
|
|
--text-tertiary: #71717a;
|
|
|
|
/* Borders */
|
|
--border-default: #27272a;
|
|
--border-muted: #3f3f46;
|
|
|
|
/* Accent colors */
|
|
--accent-primary: #3b82f6;
|
|
--accent-success: #22c55e;
|
|
--accent-warning: #eab308;
|
|
--accent-error: #ef4444;
|
|
--accent-info: #06b6d4;
|
|
|
|
/* Spacing scale */
|
|
--space-1: 4px;
|
|
--space-2: 8px;
|
|
--space-3: 12px;
|
|
--space-4: 16px;
|
|
--space-5: 20px;
|
|
--space-6: 24px;
|
|
--space-8: 32px;
|
|
|
|
/* Border radius */
|
|
--radius-sm: 4px;
|
|
--radius-md: 6px;
|
|
--radius-lg: 8px;
|
|
--radius-xl: 12px;
|
|
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
font-size: 13px;
|
|
line-height: 1.5;
|
|
color: var(--text-primary);
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
`;
|
|
|
|
export const terminalStyles: CSSResult = css`
|
|
.terminal {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
border: 1px solid var(--border-default);
|
|
background: var(--bg-primary);
|
|
border-radius: var(--radius-lg);
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.header {
|
|
border-bottom: 1px solid var(--border-default);
|
|
padding: var(--space-4) var(--space-5);
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
background: var(--bg-secondary);
|
|
}
|
|
|
|
.title {
|
|
color: var(--text-primary);
|
|
font-weight: 600;
|
|
font-size: 14px;
|
|
letter-spacing: -0.01em;
|
|
}
|
|
|
|
.uptime {
|
|
color: var(--text-tertiary);
|
|
font-size: 12px;
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
|
|
.content {
|
|
padding: var(--space-5);
|
|
min-height: 400px;
|
|
background: var(--bg-primary);
|
|
}
|
|
|
|
.footer {
|
|
border-top: 1px solid var(--border-default);
|
|
padding: var(--space-3) var(--space-5);
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
background: var(--bg-secondary);
|
|
font-size: 12px;
|
|
}
|
|
|
|
.refresh-info {
|
|
color: var(--text-tertiary);
|
|
font-size: 11px;
|
|
}
|
|
|
|
.status {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--space-2);
|
|
}
|
|
|
|
.status-dot {
|
|
width: 6px;
|
|
height: 6px;
|
|
border-radius: 50%;
|
|
background: var(--accent-success);
|
|
}
|
|
|
|
.status-dot.offline {
|
|
background: var(--accent-error);
|
|
}
|
|
|
|
.prompt {
|
|
color: var(--text-secondary);
|
|
font-size: 11px;
|
|
}
|
|
`;
|
|
|
|
export const navStyles: CSSResult = css`
|
|
.nav {
|
|
display: flex;
|
|
gap: var(--space-1);
|
|
background: var(--bg-secondary);
|
|
border-bottom: 1px solid var(--border-default);
|
|
padding: var(--space-2) var(--space-3);
|
|
}
|
|
|
|
.nav-tab {
|
|
padding: var(--space-2) var(--space-4);
|
|
cursor: pointer;
|
|
color: var(--text-secondary);
|
|
border: none;
|
|
background: transparent;
|
|
font-family: inherit;
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
transition: all 0.15s ease;
|
|
border-radius: var(--radius-sm);
|
|
}
|
|
|
|
.nav-tab:hover {
|
|
color: var(--text-primary);
|
|
background: var(--bg-tertiary);
|
|
}
|
|
|
|
.nav-tab.active {
|
|
color: var(--text-primary);
|
|
background: var(--bg-elevated);
|
|
}
|
|
|
|
.nav-tab .count {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-width: 20px;
|
|
height: 18px;
|
|
background: var(--bg-tertiary);
|
|
padding: 0 6px;
|
|
border-radius: 9999px;
|
|
font-size: 11px;
|
|
font-weight: 500;
|
|
margin-left: var(--space-2);
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.nav-tab.active .count {
|
|
background: var(--accent-primary);
|
|
color: white;
|
|
}
|
|
`;
|
|
|
|
export const panelStyles: CSSResult = css`
|
|
.grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
|
|
gap: var(--space-4);
|
|
}
|
|
|
|
.panel {
|
|
background: var(--bg-secondary);
|
|
border: 1px solid var(--border-default);
|
|
border-radius: var(--radius-lg);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.panel-title {
|
|
color: var(--text-secondary);
|
|
font-weight: 600;
|
|
font-size: 11px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.05em;
|
|
padding: var(--space-3) var(--space-4);
|
|
border-bottom: 1px solid var(--border-default);
|
|
background: var(--bg-tertiary);
|
|
}
|
|
|
|
.panel-content {
|
|
padding: var(--space-4);
|
|
}
|
|
|
|
.row {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: var(--space-2) 0;
|
|
border-bottom: 1px solid var(--border-muted);
|
|
}
|
|
|
|
.row:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.label {
|
|
color: var(--text-secondary);
|
|
font-size: 13px;
|
|
}
|
|
|
|
.value {
|
|
color: var(--text-primary);
|
|
font-weight: 500;
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
|
|
.value.warning {
|
|
color: var(--accent-warning);
|
|
}
|
|
|
|
.value.error {
|
|
color: var(--accent-error);
|
|
}
|
|
|
|
.value.success {
|
|
color: var(--accent-success);
|
|
}
|
|
`;
|
|
|
|
export const gaugeStyles: CSSResult = css`
|
|
.gauge {
|
|
margin: var(--space-3) 0;
|
|
}
|
|
|
|
.gauge-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: var(--space-2);
|
|
font-size: 12px;
|
|
}
|
|
|
|
.gauge-label {
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.gauge-value {
|
|
color: var(--text-primary);
|
|
font-weight: 600;
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
|
|
.gauge-bar {
|
|
height: 6px;
|
|
background: var(--bg-tertiary);
|
|
border-radius: 3px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.gauge-fill {
|
|
height: 100%;
|
|
border-radius: 3px;
|
|
transition: width 0.3s ease;
|
|
}
|
|
|
|
.gauge-fill.good {
|
|
background: var(--accent-success);
|
|
}
|
|
|
|
.gauge-fill.warning {
|
|
background: var(--accent-warning);
|
|
}
|
|
|
|
.gauge-fill.bad {
|
|
background: var(--accent-error);
|
|
}
|
|
`;
|
|
|
|
export const tableStyles: CSSResult = css`
|
|
.table-container {
|
|
overflow-x: auto;
|
|
border-radius: var(--radius-md);
|
|
}
|
|
|
|
.data-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.data-table th {
|
|
text-align: left;
|
|
padding: var(--space-3) var(--space-4);
|
|
background: var(--bg-tertiary);
|
|
color: var(--text-secondary);
|
|
font-weight: 500;
|
|
font-size: 12px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.05em;
|
|
cursor: pointer;
|
|
user-select: none;
|
|
white-space: nowrap;
|
|
border-bottom: 1px solid var(--border-default);
|
|
}
|
|
|
|
.data-table th:hover {
|
|
background: var(--bg-elevated);
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.data-table th .sort-icon {
|
|
margin-left: var(--space-1);
|
|
opacity: 0.4;
|
|
font-size: 10px;
|
|
}
|
|
|
|
.data-table th.sorted .sort-icon {
|
|
opacity: 1;
|
|
color: var(--accent-primary);
|
|
}
|
|
|
|
.data-table td {
|
|
padding: var(--space-3) var(--space-4);
|
|
border-bottom: 1px solid var(--border-default);
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.data-table tr:hover td {
|
|
background: var(--bg-tertiary);
|
|
}
|
|
|
|
.data-table td.url {
|
|
max-width: 400px;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
color: var(--text-secondary);
|
|
font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.data-table td.num {
|
|
text-align: right;
|
|
font-variant-numeric: tabular-nums;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.table-controls {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: var(--space-4);
|
|
gap: var(--space-3);
|
|
}
|
|
|
|
.search-input {
|
|
background: var(--bg-tertiary);
|
|
border: 1px solid var(--border-default);
|
|
color: var(--text-primary);
|
|
padding: var(--space-2) var(--space-3);
|
|
font-family: inherit;
|
|
font-size: 13px;
|
|
width: 280px;
|
|
border-radius: var(--radius-md);
|
|
transition: all 0.15s ease;
|
|
}
|
|
|
|
.search-input::placeholder {
|
|
color: var(--text-tertiary);
|
|
}
|
|
|
|
.search-input:focus {
|
|
outline: none;
|
|
border-color: var(--accent-primary);
|
|
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
}
|
|
|
|
.table-info {
|
|
color: var(--text-tertiary);
|
|
font-size: 12px;
|
|
}
|
|
|
|
.hit-rate-bar {
|
|
width: 60px;
|
|
height: 4px;
|
|
background: var(--bg-tertiary);
|
|
border-radius: 2px;
|
|
display: inline-block;
|
|
vertical-align: middle;
|
|
margin-right: var(--space-2);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.hit-rate-fill {
|
|
height: 100%;
|
|
border-radius: 2px;
|
|
}
|
|
|
|
.hit-rate-fill.good {
|
|
background: var(--accent-success);
|
|
}
|
|
|
|
.hit-rate-fill.warning {
|
|
background: var(--accent-warning);
|
|
}
|
|
|
|
.hit-rate-fill.bad {
|
|
background: var(--accent-error);
|
|
}
|
|
`;
|
|
|
|
export const buttonStyles: CSSResult = css`
|
|
.btn {
|
|
padding: var(--space-2) var(--space-4);
|
|
border-radius: var(--radius-md);
|
|
font-family: inherit;
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.15s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: var(--space-2);
|
|
}
|
|
|
|
.btn-primary {
|
|
background: var(--accent-primary);
|
|
color: white;
|
|
border: none;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: #2563eb;
|
|
}
|
|
|
|
.btn-primary:active {
|
|
background: #1d4ed8;
|
|
}
|
|
|
|
.btn-secondary {
|
|
background: var(--bg-tertiary);
|
|
color: var(--text-primary);
|
|
border: 1px solid var(--border-default);
|
|
}
|
|
|
|
.btn-secondary:hover {
|
|
background: var(--bg-elevated);
|
|
border-color: var(--border-muted);
|
|
}
|
|
|
|
.btn:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.btn-row {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
gap: var(--space-2);
|
|
margin-top: var(--space-4);
|
|
}
|
|
`;
|
|
|
|
export const speedtestStyles: CSSResult = css`
|
|
.online-indicator {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: var(--space-2);
|
|
padding: var(--space-1) var(--space-3);
|
|
border-radius: 9999px;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
margin-bottom: var(--space-4);
|
|
}
|
|
|
|
.online-indicator.online {
|
|
background: rgba(34, 197, 94, 0.1);
|
|
color: var(--accent-success);
|
|
}
|
|
|
|
.online-indicator.offline {
|
|
background: rgba(239, 68, 68, 0.1);
|
|
color: var(--accent-error);
|
|
}
|
|
|
|
.online-dot {
|
|
width: 6px;
|
|
height: 6px;
|
|
border-radius: 50%;
|
|
background: currentColor;
|
|
}
|
|
|
|
.speedtest-results {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: var(--space-4);
|
|
margin-top: var(--space-4);
|
|
}
|
|
|
|
.speedtest-metric {
|
|
text-align: center;
|
|
padding: var(--space-4);
|
|
background: var(--bg-tertiary);
|
|
border-radius: var(--radius-md);
|
|
}
|
|
|
|
.speedtest-value {
|
|
font-size: 24px;
|
|
font-weight: 600;
|
|
font-variant-numeric: tabular-nums;
|
|
color: var(--text-primary);
|
|
line-height: 1.2;
|
|
}
|
|
|
|
.speedtest-unit {
|
|
font-size: 12px;
|
|
color: var(--text-secondary);
|
|
margin-top: var(--space-1);
|
|
}
|
|
|
|
.speedtest-label {
|
|
font-size: 11px;
|
|
color: var(--text-tertiary);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.05em;
|
|
margin-top: var(--space-2);
|
|
}
|
|
|
|
.speed-bar {
|
|
height: 4px;
|
|
background: var(--bg-tertiary);
|
|
border-radius: 2px;
|
|
margin: var(--space-1) 0;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.speed-fill {
|
|
height: 100%;
|
|
background: var(--accent-success);
|
|
border-radius: 2px;
|
|
transition: width 0.5s ease;
|
|
}
|
|
|
|
/* Speedtest progress indicator */
|
|
.speedtest-progress {
|
|
padding: var(--space-4) 0;
|
|
}
|
|
|
|
.progress-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: var(--space-3);
|
|
}
|
|
|
|
.progress-phase {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: var(--space-2);
|
|
color: var(--accent-info);
|
|
font-weight: 500;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.progress-phase::before {
|
|
content: '';
|
|
width: 6px;
|
|
height: 6px;
|
|
border-radius: 50%;
|
|
background: currentColor;
|
|
animation: pulse 1s infinite;
|
|
}
|
|
|
|
.progress-time {
|
|
color: var(--text-tertiary);
|
|
font-size: 12px;
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
|
|
.progress-bar {
|
|
height: 6px;
|
|
background: var(--bg-tertiary);
|
|
border-radius: 3px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.progress-fill {
|
|
height: 100%;
|
|
background: var(--accent-info);
|
|
border-radius: 3px;
|
|
transition: width 0.1s linear;
|
|
}
|
|
|
|
.progress-fill.complete {
|
|
background: var(--accent-success);
|
|
}
|
|
|
|
@keyframes pulse {
|
|
0%, 100% { opacity: 1; }
|
|
50% { opacity: 0.4; }
|
|
}
|
|
`;
|
|
|
|
export const statusBadgeStyles: CSSResult = css`
|
|
.status-badge {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: var(--space-1);
|
|
padding: var(--space-1) var(--space-2);
|
|
border-radius: 9999px;
|
|
font-size: 11px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.status-badge.success {
|
|
background: rgba(34, 197, 94, 0.1);
|
|
color: var(--accent-success);
|
|
}
|
|
|
|
.status-badge.warning {
|
|
background: rgba(234, 179, 8, 0.1);
|
|
color: var(--accent-warning);
|
|
}
|
|
|
|
.status-badge.error {
|
|
background: rgba(239, 68, 68, 0.1);
|
|
color: var(--accent-error);
|
|
}
|
|
|
|
.status-badge.info {
|
|
background: rgba(6, 182, 212, 0.1);
|
|
color: var(--accent-info);
|
|
}
|
|
|
|
.status-badge .badge-dot {
|
|
width: 5px;
|
|
height: 5px;
|
|
border-radius: 50%;
|
|
background: currentColor;
|
|
}
|
|
`;
|