wth461694678_text-block-timer/styles.css
2026-03-01 19:34:25 +08:00

755 lines
No EOL
15 KiB
CSS

/* ===== CSS Custom Properties (defaults, overridden by JS) ===== */
:root {
/* Running timer colors */
--timer-running-color: #10b981;
--timer-running-bg: rgba(16, 185, 129, 0.15);
--timer-running-border: rgba(16, 185, 129, 0.3);
--timer-running-bg-hover: rgba(16, 185, 129, 0.25);
--timer-running-border-hover: rgba(16, 185, 129, 0.5);
/* Paused timer colors */
--timer-paused-color: #6b7280;
--timer-paused-bg: rgba(107, 114, 128, 0.12);
--timer-paused-border: rgba(107, 114, 128, 0.25);
--timer-paused-bg-hover: rgba(107, 114, 128, 0.2);
--timer-paused-border-hover: rgba(107, 114, 128, 0.4);
}
/* ===== Common widget base ===== */
.timer-widget-display {
display: inline-block;
cursor: pointer;
user-select: none;
}
/* ===== Badge Style (default) ===== */
/* Badge common properties */
.timer-style-badge .timer-r,
.timer-style-badge .timer-p,
.timer-style-badge .timer-widget-running,
.timer-style-badge .timer-widget-paused {
display: inline-block;
padding: 0 4px;
margin: 0 2px;
border-radius: 3px;
font-weight: 500;
user-select: none;
font-family: system-ui, -apple-system, sans-serif;
font-size: 0.95em;
transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
/* Badge - Running timer (preview mode) */
.timer-style-badge .timer-r {
background-color: var(--timer-running-bg);
color: var(--timer-running-color);
border: 1px solid var(--timer-running-border);
}
.timer-style-badge .timer-r:hover {
background-color: var(--timer-running-bg-hover);
border-color: var(--timer-running-border-hover);
}
/* Badge - Paused timer (preview mode) */
.timer-style-badge .timer-p {
background-color: var(--timer-paused-bg);
color: var(--timer-paused-color);
border: 1px solid var(--timer-paused-border);
}
.timer-style-badge .timer-p:hover {
background-color: var(--timer-paused-bg-hover);
border-color: var(--timer-paused-border-hover);
}
/* Badge - Running timer widget (edit mode) */
.timer-style-badge .timer-widget-running {
background-color: var(--timer-running-bg);
color: var(--timer-running-color);
border: 1px solid var(--timer-running-border);
cursor: pointer;
}
.timer-style-badge .timer-widget-running:hover {
background-color: var(--timer-running-bg-hover);
border-color: var(--timer-running-border-hover);
}
/* Badge - Paused timer widget (edit mode) */
.timer-style-badge .timer-widget-paused {
background-color: var(--timer-paused-bg);
color: var(--timer-paused-color);
border: 1px solid var(--timer-paused-border);
cursor: pointer;
}
.timer-style-badge .timer-widget-paused:hover {
background-color: var(--timer-paused-bg-hover);
border-color: var(--timer-paused-border-hover);
}
/* ===== Plain Style ===== */
/* Plain - Running timer (preview mode) */
.timer-style-plain .timer-r {
color: var(--timer-running-color);
}
/* Plain - Paused timer (preview mode) - no special style, inherit default */
.timer-style-plain .timer-p {
color: var(--timer-paused-color);
}
/* Plain - Running timer widget (edit mode) */
.timer-style-plain .timer-widget-running {
color: var(--timer-running-color);
cursor: pointer;
}
/* Plain - Paused timer widget (edit mode) */
.timer-style-plain .timer-widget-paused {
color: var(--timer-paused-color);
cursor: pointer;
}
/* ===== Color Picker Settings UI ===== */
.timer-color-setting {
display: flex;
align-items: center;
gap: 8px;
}
.timer-color-preview {
width: 28px;
height: 28px;
border-radius: 4px;
border: 1px solid var(--background-modifier-border);
cursor: pointer;
transition: box-shadow 0.2s ease;
}
.timer-color-preview:hover {
box-shadow: 0 0 0 2px var(--interactive-accent);
}
.timer-color-input {
position: absolute;
width: 0;
height: 0;
opacity: 0;
overflow: hidden;
}
/* ===== Time Picker Modal (iPhone-style scroll wheel) ===== */
.timer-picker-modal.modal {
max-width: 380px;
width: 90vw;
border-radius: 16px;
padding: 0;
overflow: hidden;
background: var(--background-primary);
}
.timer-picker-modal .modal-content {
padding: 0;
}
.timer-picker-modal .modal-close-button {
display: none;
}
.timer-picker-header {
display: flex;
align-items: center;
justify-content: center;
padding: 20px 24px 16px;
}
.timer-picker-title {
font-size: 15px;
font-weight: 600;
color: var(--text-normal);
}
.timer-picker-wheels {
display: flex;
justify-content: center;
align-items: flex-start;
padding: 0 20px;
position: relative;
gap: 0;
}
.timer-picker-highlight {
position: absolute;
left: 24px;
right: 24px;
border: 1.5px solid var(--background-modifier-border);
border-radius: 10px;
pointer-events: none;
z-index: 0;
display: flex;
align-items: center;
}
.timer-picker-colon {
display: flex;
align-items: center;
justify-content: center;
position: relative;
width: 14px;
flex-shrink: 0;
font-size: 20px;
font-weight: 700;
color: var(--text-muted);
z-index: 1;
user-select: none;
height: 36px;
}
.timer-picker-column {
display: flex;
flex-direction: column;
align-items: center;
flex: 1;
z-index: 1;
}
.timer-picker-viewport {
overflow: hidden;
position: relative;
cursor: grab;
touch-action: none;
width: 100%;
}
.timer-picker-viewport:active {
cursor: grabbing;
}
.timer-picker-list {
will-change: transform;
}
.timer-picker-item {
display: flex;
align-items: center;
justify-content: center;
transition: opacity 0.15s, font-size 0.15s;
user-select: none;
-webkit-user-select: none;
}
.timer-picker-label {
display: none;
}
.timer-picker-footer {
display: flex;
justify-content: flex-end;
padding: 12px 24px 18px;
}
.timer-picker-save-btn {
background: transparent;
color: #22c55e;
border: none;
border-radius: 8px;
padding: 6px 14px;
font-size: 22px;
font-weight: 700;
cursor: pointer;
transition: background-color 0.15s ease;
line-height: 1;
}
.timer-picker-save-btn:hover {
background-color: rgba(34, 197, 94, 0.15);
}
/* ===== Disabled Menu Item (Time Adjustment on running timers) ===== */
.timer-menu-disabled {
background-color: var(--background-modifier-hover) !important;
opacity: 0.55;
}
.timer-menu-tooltip {
position: fixed;
z-index: 10000;
padding: 4px 10px;
border-radius: 6px;
font-size: 12px;
color: var(--text-on-accent);
background: var(--background-modifier-message);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
white-space: nowrap;
pointer-events: none;
animation: timer-tooltip-fadein 0.1s ease;
}
@keyframes timer-tooltip-fadein {
from {
opacity: 0;
transform: translateY(4px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* ===== Timer Sidebar ===== */
.timer-sidebar-container {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
padding: 0;
}
.timer-sidebar-toolbar {
padding: 8px 10px 4px;
flex-shrink: 0;
}
.timer-toolbar-row {
display: flex;
align-items: center;
gap: 6px;
margin-bottom: 6px;
}
.timer-toolbar-controls {
flex-wrap: wrap;
}
.timer-segmented-control {
display: flex;
border: 1px solid var(--background-modifier-border);
border-radius: 6px;
overflow: hidden;
width: 100%;
}
.timer-seg-btn {
flex: 1;
padding: 4px 6px;
font-size: 12px;
border: none;
background: transparent;
cursor: pointer;
color: var(--text-muted);
transition: background 0.15s, color 0.15s;
}
.timer-seg-btn:not(:last-child) {
border-right: 1px solid var(--background-modifier-border);
}
.timer-seg-btn.is-active {
background: var(--interactive-accent);
color: var(--text-on-accent);
}
.timer-seg-btn:hover:not(.is-active) {
background: var(--background-modifier-hover);
color: var(--text-normal);
}
.timer-filter-select,
.timer-sort-select {
flex: 1;
font-size: 12px;
padding: 3px 4px;
border-radius: 4px;
border: 1px solid var(--background-modifier-border);
background: var(--background-primary);
color: var(--text-normal);
cursor: pointer;
}
.timer-sidebar-summary {
padding: 6px 10px;
font-size: 12px;
color: var(--text-muted);
flex-shrink: 0;
}
.timer-summary-row {
display: flex;
gap: 4px;
align-items: center;
flex-wrap: wrap;
}
.timer-summary-item {
display: flex;
align-items: center;
gap: 4px;
padding: 2px 7px;
border-radius: 10px;
background: var(--background-secondary);
white-space: nowrap;
line-height: 1.4;
}
.timer-summary-item.timer-summary-running {
color: var(--color-green, #10b981);
}
.timer-summary-item.timer-summary-paused {
color: var(--text-muted);
}
.timer-summary-label {
font-size: 12px;
line-height: 1;
display: inline-flex;
align-items: center;
opacity: 0.75;
}
.timer-summary-icon {
display: block;
flex-shrink: 0;
opacity: 0.85;
}
.timer-summary-value {
font-size: 12px;
line-height: 1;
font-weight: 600;
font-variant-numeric: tabular-nums;
}
.timer-sidebar-list {
flex: 1;
overflow-y: auto;
padding: 6px 8px;
}
/* Timer Card */
.timer-card {
border: 1px solid var(--background-modifier-border);
border-radius: 6px;
padding: 8px 10px;
margin-bottom: 6px;
transition: background 0.15s;
}
.timer-card:hover {
background: var(--background-modifier-hover);
}
.timer-card-running {
border-left: 3px solid var(--timer-running-color);
}
.timer-card-paused {
border-left: 3px solid var(--timer-paused-color);
}
.timer-card-header {
display: flex;
align-items: center;
gap: 6px;
margin-bottom: 4px;
}
.timer-card-dot {
width: 8px;
height: 8px;
border-radius: 50%;
flex-shrink: 0;
}
.timer-dot-running {
background: var(--timer-running-color);
box-shadow: 0 0 0 0 var(--timer-running-color);
animation: timer-dot-pulse 1.5s infinite;
}
.timer-dot-paused {
background: var(--timer-paused-color);
}
@keyframes timer-dot-pulse {
0% {
box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
}
70% {
box-shadow: 0 0 0 5px rgba(16, 185, 129, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
}
}
.timer-card-duration {
font-family: monospace;
font-size: 13px;
font-weight: 600;
color: var(--text-normal);
}
.timer-card-project {
font-size: 11px;
padding: 1px 6px;
border-radius: 10px;
background: var(--interactive-accent);
color: var(--text-on-accent);
margin-left: auto;
}
.timer-card-text {
font-size: 12px;
color: var(--text-normal);
margin-bottom: 3px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.timer-card-file-source {
font-size: 11px;
color: var(--text-muted);
margin-bottom: 4px;
}
.timer-card-file-source:hover {
color: var(--text-accent);
text-decoration: underline;
}
.timer-card-actions {
display: flex;
gap: 4px;
justify-content: flex-end;
}
.timer-card-btn {
padding: 2px 8px;
font-size: 13px;
border-radius: 4px;
border: 1px solid var(--background-modifier-border);
background: transparent;
cursor: pointer;
color: var(--text-muted);
transition: background 0.15s, color 0.15s;
}
.timer-card-btn:hover {
background: var(--background-modifier-hover);
color: var(--text-normal);
}
/* Empty state */
.timer-empty-state {
display: flex;
align-items: center;
justify-content: center;
height: 80px;
color: var(--text-muted);
font-size: 13px;
}
/* Scan progress */
.timer-scan-progress {
padding: 16px;
text-align: center;
}
.timer-scan-progress-text {
font-size: 12px;
color: var(--text-muted);
margin-bottom: 8px;
}
.timer-scan-progress-bar {
height: 4px;
background: var(--background-modifier-border);
border-radius: 2px;
overflow: hidden;
margin-bottom: 10px;
}
.timer-scan-progress-bar-fill {
height: 100%;
background: var(--interactive-accent);
width: 0%;
transition: width 0.3s ease;
}
.timer-scan-cancel-btn {
font-size: 12px;
padding: 3px 12px;
border-radius: 4px;
border: 1px solid var(--background-modifier-border);
background: transparent;
cursor: pointer;
color: var(--text-muted);
}
/* Compact mode (width < 200px) */
.timer-sidebar-compact .timer-card-file-source {
display: none;
}
.timer-sidebar-compact .timer-seg-btn {
font-size: 10px;
padding: 3px 2px;
}
/* File groups container */
.timer-file-groups-container {
margin-top: 8px;
}
.timer-file-group-item {
margin-bottom: 8px;
}
/* ===== Statistics Chart Styles ===== */
.timer-statistics-container {
padding: 8px 10px;
background: var(--background-secondary);
}
.timer-statistics-toggle {
display: flex;
align-items: center;
gap: 6px;
padding: 4px 8px;
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
background: var(--background-primary);
color: var(--text-normal);
font-size: 12px;
cursor: pointer;
transition: background 0.15s, border-color 0.15s;
margin-bottom: 8px;
}
.timer-statistics-toggle:hover {
background: var(--background-modifier-hover);
border-color: var(--interactive-accent);
}
.timer-statistics-toggle.is-active {
background: var(--interactive-accent);
color: var(--text-on-accent);
border-color: var(--interactive-accent);
}
.timer-chart-container {
height: 300px;
width: 100%;
border-radius: 6px;
background: var(--background-primary);
border: 1px solid var(--background-modifier-border);
}
.timer-chart-error {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
color: var(--text-muted);
font-size: 12px;
text-align: center;
padding: 20px;
}
.timer-toolbar-stats-row {
justify-content: center;
margin-top: 4px;
}
.timer-stats-toggle {
padding: 4px 12px;
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
background: var(--background-primary);
color: var(--text-normal);
font-size: 12px;
cursor: pointer;
transition: background 0.15s, border-color 0.15s;
}
.timer-stats-toggle:hover {
background: var(--background-modifier-hover);
border-color: var(--interactive-accent);
}
.timer-stats-toggle.is-active {
background: var(--interactive-accent);
color: var(--text-on-accent);
border-color: var(--interactive-accent);
}
/* ── Statistics Chart ─────────────────────────────────────────────────── */
.timer-statistics-container {
padding: 4px 8px 8px;
}
.timer-chart-container {
width: 100%;
min-height: 320px;
}
.timer-chart-empty,
.timer-chart-error {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
min-height: 80px;
color: var(--text-muted);
font-size: 12px;
}