wth461694678_text-block-timer/styles.css
Carrianna b729e2fe5b V1.0.9
1. **==Critical Bug Fix==**: Fixed the undo history pollution issue — timer real-time updates no longer pollute the editor's undo/redo stack. (Thanks to [mosmash](https://github.com/mosmash) for reporting!)
2. **Timer Style Optimization**: Redesigned the timer rendering style; added option to hide hours digit for shorter durations.
3. **==New Feature==**: Added Time Adjustment function with an iPhone-style scroll wheel time picker UI, accessible via right-click menu and command palette, fully compatible with mobile.
4. Closed issues: [#12](https://github.com/wth461694678/text-block-timer/issues/12), [#11](https://github.com/wth461694678/text-block-timer/issues/11), [#7](https://github.com/wth461694678/text-block-timer/issues/7)
2026-02-13 18:59:58 +08:00

329 lines
No EOL
6.9 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);
}
}