From eea0c48a4459462ef0a6217b4f9ec436db245e9d Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 1 Jun 2026 13:35:50 +0800 Subject: [PATCH] refactor webui dashboard layout --- webui/css/README.md | 6 +- webui/css/components.css | 381 ------ webui/css/components_overlays.css | 234 ++++ webui/css/components_toast.css | 148 +++ webui/css/premium.css | 1902 ++++++++++++++++++++++++++++ webui/index.html | 522 +------- webui/js/config_panel_templates.js | 265 ++++ webui/js/log_views.js | 3 +- webui/js/panel_templates.js | 125 ++ webui/js/premium_ui.js | 424 +++++++ webui/js/theme_bootstrap.js | 13 + webui/js/top_templates.js | 112 ++ 12 files changed, 3266 insertions(+), 869 deletions(-) create mode 100644 webui/css/components_overlays.css create mode 100644 webui/css/components_toast.css create mode 100644 webui/css/premium.css create mode 100644 webui/js/config_panel_templates.js create mode 100644 webui/js/panel_templates.js create mode 100644 webui/js/premium_ui.js create mode 100644 webui/js/theme_bootstrap.js create mode 100644 webui/js/top_templates.js diff --git a/webui/css/README.md b/webui/css/README.md index 28a72bd..6e27eec 100644 --- a/webui/css/README.md +++ b/webui/css/README.md @@ -8,7 +8,9 @@ Recommended order: 2. `base.css` 3. `layout.css` 4. `components.css` -5. focused panel or feature CSS -6. `styles.css` compatibility remainder +5. `components_overlays.css` +6. `components_toast.css` +7. focused panel or feature CSS +8. `styles.css` compatibility remainder Keep selectors stable so existing HTML and JavaScript continue to work. diff --git a/webui/css/components.css b/webui/css/components.css index 66c6948..98e0231 100644 --- a/webui/css/components.css +++ b/webui/css/components.css @@ -1185,384 +1185,3 @@ input[type="number"]::-webkit-outer-spin-button { background: var(--success); box-shadow: 0 0 0 2px color-mix(in oklab, var(--success) 16%, transparent); } - -/* ==================== Tooltip (data-tooltip) ==================== */ -[data-tooltip] { - position: relative; -} - -[data-tooltip]::before, -[data-tooltip]::after { - position: absolute; - left: 50%; - bottom: calc(100% + 8px); - transform: translateX(-50%) translateY(2px); - pointer-events: none; - opacity: 0; - transition: opacity 120ms ease, transform 120ms ease; - z-index: 50; -} - -[data-tooltip]::before { - content: attr(data-tooltip); - padding: 6px 10px; - border: 1px solid color-mix(in oklab, var(--primary) 35%, var(--border)); - border-radius: var(--radius-sm); - background: color-mix(in oklab, var(--surface) 90%, transparent); - color: var(--text-strong); - font-family: "IBM Plex Mono", ui-monospace, monospace; - font-size: 12px; - font-weight: 600; - letter-spacing: 0.04em; - text-transform: none; - white-space: nowrap; - box-shadow: - 0 0 0 1px color-mix(in oklab, var(--primary) 20%, transparent), - 0 4px 14px -2px color-mix(in oklab, var(--primary) 40%, transparent); - backdrop-filter: blur(10px); -} - -:root[data-theme="dark"] [data-tooltip]::before { - box-shadow: - 0 0 0 1px color-mix(in oklab, var(--primary) 28%, transparent), - 0 4px 14px -2px color-mix(in oklab, var(--primary) 50%, transparent); -} - -[data-tooltip]::after { - content: ""; - width: 8px; - height: 8px; - bottom: calc(100% + 4px); - border: 1px solid color-mix(in oklab, var(--primary) 35%, var(--border)); - border-top: 0; - border-left: 0; - background: color-mix(in oklab, var(--surface) 90%, transparent); - transform: translateX(-50%) rotate(45deg); -} - -[data-tooltip]:hover::before, -[data-tooltip]:hover::after, -[data-tooltip]:focus-visible::before, -[data-tooltip]:focus-visible::after { - opacity: 1; - transform: translateX(-50%) translateY(0); -} - -[data-tooltip]:hover::after, -[data-tooltip]:focus-visible::after { - transform: translateX(-50%) rotate(45deg); -} - -/* Position bottom (below the trigger) */ -[data-tooltip][data-tooltip-pos="bottom"]::before, -[data-tooltip][data-tooltip-pos="bottom"]::after { - bottom: auto; - top: calc(100% + 8px); -} - -[data-tooltip][data-tooltip-pos="bottom"]::after { - top: calc(100% + 4px); - border: 1px solid var(--border); - border-bottom: 0; - border-right: 0; -} - -@media (max-width: 640px) { - [data-tooltip]::before, - [data-tooltip]::after { display: none; } -} - - -/* ==================== Shortcuts help overlay ==================== */ -.shortcutsOverlay { - position: fixed; - inset: 0; - z-index: 90; - display: flex; - align-items: center; - justify-content: center; - padding: 24px; - background: color-mix(in oklab, var(--bg) 70%, transparent); - backdrop-filter: blur(6px); - opacity: 0; - transition: opacity 160ms ease; -} - -.shortcutsOverlay.isVisible { - opacity: 1; -} - -.shortcutsCard { - position: relative; - width: min(420px, 100%); - border: 1px solid var(--border); - border-radius: var(--radius-lg); - background: var(--surface); - box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.1); - overflow: hidden; - transform: translateY(8px) scale(0.98); - transition: transform 200ms cubic-bezier(0.2, 0.7, 0.2, 1); -} - -.shortcutsCard::before { - position: absolute; - inset: 0 0 auto 0; - height: 1px; - content: ""; - pointer-events: none; - background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--primary) 70%, transparent), color-mix(in oklab, var(--secondary) 70%, transparent), transparent); - opacity: 0.7; -} - -:root[data-theme="dark"] .shortcutsCard { - box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.5); -} - -.shortcutsOverlay.isVisible .shortcutsCard { - transform: translateY(0) scale(1); -} - -.shortcutsHeader { - display: flex; - align-items: center; - justify-content: space-between; - padding: 12px 14px 10px; - border-bottom: 1px solid var(--border); - background: var(--surface-soft); -} - -.shortcutsTitle { - font-size: 15px; - font-weight: 600; - color: var(--text-strong); - letter-spacing: var(--tracking-tight); -} - -.shortcutsClose { - display: inline-flex; - align-items: center; - justify-content: center; - width: 24px; - height: 24px; - padding: 0; - border: 0; - border-radius: var(--radius-sm); - color: var(--muted); - background: transparent; - cursor: pointer; - transition: color var(--motion-fast), background var(--motion-fast); -} - -.shortcutsClose:hover { - color: var(--primary); - background: color-mix(in oklab, var(--primary-soft) 60%, transparent); - box-shadow: 0 0 10px -2px color-mix(in oklab, var(--primary) 45%, transparent); -} - -.shortcutsList { - display: grid; - gap: 2px; - padding: 8px; -} - -.shortcutsRow { - display: flex; - align-items: center; - justify-content: space-between; - gap: 12px; - padding: 8px 10px; - border-radius: var(--radius-sm); - font-size: var(--text-sm); - color: var(--text); -} - -.shortcutsRow:hover { - background: var(--surface-soft); -} - -.shortcutsDesc { - color: var(--text); -} - -.shortcutsKeys { - display: inline-flex; - align-items: center; - gap: 4px; -} - -.shortcutsKeys kbd { - display: inline-flex; - align-items: center; - justify-content: center; - min-width: 22px; - height: 22px; - padding: 0 6px; - border: 1px solid var(--border-strong); - border-bottom-width: 2px; - border-radius: 5px; - background: var(--surface); - color: var(--text-strong); - font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; - font-size: 13px; - letter-spacing: 0.04em; -} - -.shortcutsPlus { - color: var(--muted-soft); - font-size: 12px; - font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; -} - -@media (prefers-reduced-motion: reduce) { - .shortcutsOverlay, - .shortcutsCard { - transition: none; - } -} - -/* ==================== Toast ==================== */ -.toastContainer { - position: fixed; - right: 20px; - bottom: 20px; - z-index: 100; - display: flex; - flex-direction: column; - gap: 8px; - max-width: min(420px, calc(100vw - 40px)); - pointer-events: none; -} - -.toast { - display: grid; - grid-template-columns: 22px 1fr auto; - align-items: start; - gap: 10px; - padding: 12px 12px 12px 16px; - border: 1px solid var(--border); - border-radius: var(--radius-md); - background: var(--surface); - color: var(--text); - font-size: var(--text-sm); - line-height: var(--leading-snug); - box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08); - pointer-events: auto; - animation: toastIn 200ms cubic-bezier(0.2, 0.7, 0.2, 1); - position: relative; - overflow: hidden; -} - -:root[data-theme="dark"] .toast { - box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4); -} - -.toast::before { - position: absolute; - left: 0; - top: 0; - bottom: 0; - width: 3px; - content: ""; - background: linear-gradient(180deg, var(--muted-soft), color-mix(in oklab, var(--muted-soft) 40%, transparent)); -} - -.toast-success { - border-color: color-mix(in oklab, var(--success) 30%, var(--border)); -} -.toast-success::before { background: linear-gradient(180deg, var(--success), color-mix(in oklab, var(--success) 30%, transparent)); } -.toast-success .toastIcon { - color: var(--success); - background: color-mix(in oklab, var(--success) 12%, transparent); - box-shadow: 0 0 10px -2px color-mix(in oklab, var(--success) 60%, transparent); -} - -.toast-error { - border-color: color-mix(in oklab, var(--danger) 30%, var(--border)); -} -.toast-error::before { background: linear-gradient(180deg, var(--danger), color-mix(in oklab, var(--danger) 30%, transparent)); } -.toast-error .toastIcon { - color: var(--danger); - background: color-mix(in oklab, var(--danger) 12%, transparent); - box-shadow: 0 0 10px -2px color-mix(in oklab, var(--danger) 60%, transparent); -} - -.toast-warn { - border-color: color-mix(in oklab, var(--warning) 30%, var(--border)); -} -.toast-warn::before { background: linear-gradient(180deg, var(--warning), color-mix(in oklab, var(--warning) 30%, transparent)); } -.toast-warn .toastIcon { - color: var(--warning); - background: color-mix(in oklab, var(--warning) 12%, transparent); - box-shadow: 0 0 10px -2px color-mix(in oklab, var(--warning) 60%, transparent); -} - -.toast-info::before { background: linear-gradient(180deg, var(--primary), var(--secondary)); } -.toast-info .toastIcon { - color: var(--primary); - background: color-mix(in oklab, var(--primary) 14%, transparent); - box-shadow: 0 0 10px -2px color-mix(in oklab, var(--primary) 60%, transparent); -} - -.toastIcon { - display: inline-flex; - align-items: center; - justify-content: center; - width: 22px; - height: 22px; - margin-top: 0; - border-radius: 50%; - flex: 0 0 22px; -} - -.toastIcon svg { - width: 14px; - height: 14px; -} - -.toastBody { - min-width: 0; - color: var(--text); - overflow-wrap: anywhere; -} - -.toastClose { - display: inline-flex; - align-items: center; - justify-content: center; - width: 22px; - height: 22px; - margin: -2px -2px 0 4px; - padding: 0; - border: 0; - border-radius: var(--radius-sm); - color: var(--muted-soft); - background: transparent; - cursor: pointer; - transition: background var(--motion-fast), color var(--motion-fast); -} - -.toastClose:hover { - color: var(--primary); - background: color-mix(in oklab, var(--primary-soft) 60%, transparent); - box-shadow: 0 0 10px -2px color-mix(in oklab, var(--primary) 45%, transparent); -} - -.toast.isLeaving { - animation: toastOut 220ms ease forwards; -} - -@keyframes toastIn { - from { opacity: 0; transform: translateY(8px); } - to { opacity: 1; transform: translateY(0); } -} - -@keyframes toastOut { - to { opacity: 0; transform: translateY(-4px); } -} - -@media (prefers-reduced-motion: reduce) { - .toast, - .toast.isLeaving { - animation: none; - } -} diff --git a/webui/css/components_overlays.css b/webui/css/components_overlays.css new file mode 100644 index 0000000..d371555 --- /dev/null +++ b/webui/css/components_overlays.css @@ -0,0 +1,234 @@ +/* Overlay components split from components.css: tooltip and shortcuts */ + +/* ==================== Tooltip (data-tooltip) ==================== */ +[data-tooltip] { + position: relative; +} + +[data-tooltip]::before, +[data-tooltip]::after { + position: absolute; + left: 50%; + bottom: calc(100% + 8px); + transform: translateX(-50%) translateY(2px); + pointer-events: none; + opacity: 0; + transition: opacity 120ms ease, transform 120ms ease; + z-index: 50; +} + +[data-tooltip]::before { + content: attr(data-tooltip); + padding: 6px 10px; + border: 1px solid color-mix(in oklab, var(--primary) 35%, var(--border)); + border-radius: var(--radius-sm); + background: color-mix(in oklab, var(--surface) 90%, transparent); + color: var(--text-strong); + font-family: "IBM Plex Mono", ui-monospace, monospace; + font-size: 12px; + font-weight: 600; + letter-spacing: 0.04em; + text-transform: none; + white-space: nowrap; + box-shadow: + 0 0 0 1px color-mix(in oklab, var(--primary) 20%, transparent), + 0 4px 14px -2px color-mix(in oklab, var(--primary) 40%, transparent); + backdrop-filter: blur(10px); +} + +:root[data-theme="dark"] [data-tooltip]::before { + box-shadow: + 0 0 0 1px color-mix(in oklab, var(--primary) 28%, transparent), + 0 4px 14px -2px color-mix(in oklab, var(--primary) 50%, transparent); +} + +[data-tooltip]::after { + content: ""; + width: 8px; + height: 8px; + bottom: calc(100% + 4px); + border: 1px solid color-mix(in oklab, var(--primary) 35%, var(--border)); + border-top: 0; + border-left: 0; + background: color-mix(in oklab, var(--surface) 90%, transparent); + transform: translateX(-50%) rotate(45deg); +} + +[data-tooltip]:hover::before, +[data-tooltip]:hover::after, +[data-tooltip]:focus-visible::before, +[data-tooltip]:focus-visible::after { + opacity: 1; + transform: translateX(-50%) translateY(0); +} + +[data-tooltip]:hover::after, +[data-tooltip]:focus-visible::after { + transform: translateX(-50%) rotate(45deg); +} + +/* Position bottom (below the trigger) */ +[data-tooltip][data-tooltip-pos="bottom"]::before, +[data-tooltip][data-tooltip-pos="bottom"]::after { + bottom: auto; + top: calc(100% + 8px); +} + +[data-tooltip][data-tooltip-pos="bottom"]::after { + top: calc(100% + 4px); + border: 1px solid var(--border); + border-bottom: 0; + border-right: 0; +} + +@media (max-width: 640px) { + [data-tooltip]::before, + [data-tooltip]::after { display: none; } +} + +/* ==================== Shortcuts help overlay ==================== */ +.shortcutsOverlay { + position: fixed; + inset: 0; + z-index: 90; + display: flex; + align-items: center; + justify-content: center; + padding: 24px; + background: color-mix(in oklab, var(--bg) 70%, transparent); + backdrop-filter: blur(6px); + opacity: 0; + transition: opacity 160ms ease; +} + +.shortcutsOverlay.isVisible { + opacity: 1; +} + +.shortcutsCard { + position: relative; + width: min(420px, 100%); + border: 1px solid var(--border); + border-radius: var(--radius-lg); + background: var(--surface); + box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.1); + overflow: hidden; + transform: translateY(8px) scale(0.98); + transition: transform 200ms cubic-bezier(0.2, 0.7, 0.2, 1); +} + +.shortcutsCard::before { + position: absolute; + inset: 0 0 auto 0; + height: 1px; + content: ""; + pointer-events: none; + background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--primary) 70%, transparent), color-mix(in oklab, var(--secondary) 70%, transparent), transparent); + opacity: 0.7; +} + +:root[data-theme="dark"] .shortcutsCard { + box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.5); +} + +.shortcutsOverlay.isVisible .shortcutsCard { + transform: translateY(0) scale(1); +} + +.shortcutsHeader { + display: flex; + align-items: center; + justify-content: space-between; + padding: 12px 14px 10px; + border-bottom: 1px solid var(--border); + background: var(--surface-soft); +} + +.shortcutsTitle { + font-size: 15px; + font-weight: 600; + color: var(--text-strong); + letter-spacing: var(--tracking-tight); +} + +.shortcutsClose { + display: inline-flex; + align-items: center; + justify-content: center; + width: 24px; + height: 24px; + padding: 0; + border: 0; + border-radius: var(--radius-sm); + color: var(--muted); + background: transparent; + cursor: pointer; + transition: color var(--motion-fast), background var(--motion-fast); +} + +.shortcutsClose:hover { + color: var(--primary); + background: color-mix(in oklab, var(--primary-soft) 60%, transparent); + box-shadow: 0 0 10px -2px color-mix(in oklab, var(--primary) 45%, transparent); +} + +.shortcutsList { + display: grid; + gap: 2px; + padding: 8px; +} + +.shortcutsRow { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; + padding: 8px 10px; + border-radius: var(--radius-sm); + font-size: var(--text-sm); + color: var(--text); +} + +.shortcutsRow:hover { + background: var(--surface-soft); +} + +.shortcutsDesc { + color: var(--text); +} + +.shortcutsKeys { + display: inline-flex; + align-items: center; + gap: 4px; +} + +.shortcutsKeys kbd { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 22px; + height: 22px; + padding: 0 6px; + border: 1px solid var(--border-strong); + border-bottom-width: 2px; + border-radius: 5px; + background: var(--surface); + color: var(--text-strong); + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; + font-size: 13px; + letter-spacing: 0.04em; +} + +.shortcutsPlus { + color: var(--muted-soft); + font-size: 12px; + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; +} + +@media (prefers-reduced-motion: reduce) { + .shortcutsOverlay, + .shortcutsCard { + transition: none; + } +} diff --git a/webui/css/components_toast.css b/webui/css/components_toast.css new file mode 100644 index 0000000..227081d --- /dev/null +++ b/webui/css/components_toast.css @@ -0,0 +1,148 @@ +/* Toast component split from components.css */ + +/* ==================== Toast ==================== */ +.toastContainer { + position: fixed; + right: 20px; + bottom: 20px; + z-index: 100; + display: flex; + flex-direction: column; + gap: 8px; + max-width: min(420px, calc(100vw - 40px)); + pointer-events: none; +} + +.toast { + display: grid; + grid-template-columns: 22px 1fr auto; + align-items: start; + gap: 10px; + padding: 12px 12px 12px 16px; + border: 1px solid var(--border); + border-radius: var(--radius-md); + background: var(--surface); + color: var(--text); + font-size: var(--text-sm); + line-height: var(--leading-snug); + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08); + pointer-events: auto; + animation: toastIn 200ms cubic-bezier(0.2, 0.7, 0.2, 1); + position: relative; + overflow: hidden; +} + +:root[data-theme="dark"] .toast { + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4); +} + +.toast::before { + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: 3px; + content: ""; + background: linear-gradient(180deg, var(--muted-soft), color-mix(in oklab, var(--muted-soft) 40%, transparent)); +} + +.toast-success { + border-color: color-mix(in oklab, var(--success) 30%, var(--border)); +} +.toast-success::before { background: linear-gradient(180deg, var(--success), color-mix(in oklab, var(--success) 30%, transparent)); } +.toast-success .toastIcon { + color: var(--success); + background: color-mix(in oklab, var(--success) 12%, transparent); + box-shadow: 0 0 10px -2px color-mix(in oklab, var(--success) 60%, transparent); +} + +.toast-error { + border-color: color-mix(in oklab, var(--danger) 30%, var(--border)); +} +.toast-error::before { background: linear-gradient(180deg, var(--danger), color-mix(in oklab, var(--danger) 30%, transparent)); } +.toast-error .toastIcon { + color: var(--danger); + background: color-mix(in oklab, var(--danger) 12%, transparent); + box-shadow: 0 0 10px -2px color-mix(in oklab, var(--danger) 60%, transparent); +} + +.toast-warn { + border-color: color-mix(in oklab, var(--warning) 30%, var(--border)); +} +.toast-warn::before { background: linear-gradient(180deg, var(--warning), color-mix(in oklab, var(--warning) 30%, transparent)); } +.toast-warn .toastIcon { + color: var(--warning); + background: color-mix(in oklab, var(--warning) 12%, transparent); + box-shadow: 0 0 10px -2px color-mix(in oklab, var(--warning) 60%, transparent); +} + +.toast-info::before { background: linear-gradient(180deg, var(--primary), var(--secondary)); } +.toast-info .toastIcon { + color: var(--primary); + background: color-mix(in oklab, var(--primary) 14%, transparent); + box-shadow: 0 0 10px -2px color-mix(in oklab, var(--primary) 60%, transparent); +} + +.toastIcon { + display: inline-flex; + align-items: center; + justify-content: center; + width: 22px; + height: 22px; + margin-top: 0; + border-radius: 50%; + flex: 0 0 22px; +} + +.toastIcon svg { + width: 14px; + height: 14px; +} + +.toastBody { + min-width: 0; + color: var(--text); + overflow-wrap: anywhere; +} + +.toastClose { + display: inline-flex; + align-items: center; + justify-content: center; + width: 22px; + height: 22px; + margin: -2px -2px 0 4px; + padding: 0; + border: 0; + border-radius: var(--radius-sm); + color: var(--muted-soft); + background: transparent; + cursor: pointer; + transition: background var(--motion-fast), color var(--motion-fast); +} + +.toastClose:hover { + color: var(--primary); + background: color-mix(in oklab, var(--primary-soft) 60%, transparent); + box-shadow: 0 0 10px -2px color-mix(in oklab, var(--primary) 45%, transparent); +} + +.toast.isLeaving { + animation: toastOut 220ms ease forwards; +} + +@keyframes toastIn { + from { opacity: 0; transform: translateY(8px); } + to { opacity: 1; transform: translateY(0); } +} + +@keyframes toastOut { + to { opacity: 0; transform: translateY(-4px); } +} + +@media (prefers-reduced-motion: reduce) { + .toast, + .toast.isLeaving { + animation: none; + } +} diff --git a/webui/css/premium.css b/webui/css/premium.css new file mode 100644 index 0000000..2ef66bb --- /dev/null +++ b/webui/css/premium.css @@ -0,0 +1,1902 @@ +/* Layout rework layer. Loaded last; keeps existing WebUI behavior intact. */ +:root { + --bg: #eef4f1; + --bg-soft: #e4ece8; + --surface: #fbfdfc; + --surface-solid: #fbfdfc; + --surface-soft: #f3f8f6; + --surface-muted: #e6efeb; + --border: #c9d8d2; + --border-strong: #8ca49a; + --hairline: rgba(7, 18, 15, 0.08); + --text: #17231f; + --text-strong: #07110e; + --muted: #63756e; + --muted-soft: #8da099; + --primary: #f43f5e; + --primary-hover: #db2548; + --primary-soft: #fff0f3; + --primary-border: #f7a7b7; + --primary-accent-text: #a51631; + --secondary: #0f9f8e; + --secondary-soft: #e7f7f4; + --secondary-border: #8bd5ca; + --success: #16875b; + --success-soft: #e8f7ef; + --warning: #b97918; + --warning-soft: #fff5e6; + --warning-border: #ecc47e; + --danger: #cc2f49; + --danger-hover: #a91f36; + --danger-soft: #fff0f3; + --danger-border: #f5adbb; + --on-primary: #ffffff; + --header-bg: rgba(251, 253, 252, 0.92); + --hover-border: #5d8f82; + --chart-track: #d8e4df; + --preview-bg: #f6faf8; + --shadow: 0 16px 36px rgba(21, 38, 33, 0.10), 0 1px 0 rgba(255, 255, 255, 0.78) inset; + --shadow-soft: 0 6px 18px rgba(21, 38, 33, 0.07), 0 1px 0 rgba(255, 255, 255, 0.82) inset; + --focus-ring: 0 0 0 3px rgba(15, 159, 142, 0.20), 0 0 0 6px rgba(244, 63, 94, 0.10); + --radius: 8px; + --radius-sm: 5px; + --radius-md: 8px; + --radius-lg: 8px; + --radius-xl: 8px; + --control-height: 38px; + --page-max: 1880px; + --page-pad: clamp(12px, 1.35vw, 24px); + --shell-gap: 14px; + --overview-gap: 10px; + --rail-width: 276px; + --panel-max: none; + --motion-fast: 120ms cubic-bezier(0.16, 1, 0.3, 1); + --motion: 180ms cubic-bezier(0.16, 1, 0.3, 1); + --motion-slow: 280ms cubic-bezier(0.16, 1, 0.3, 1); + --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif; + --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; + color-scheme: light; +} + +:root[data-theme="dark"] { + --bg: #111816; + --bg-soft: #17211e; + --surface: #f8fbfa; + --surface-solid: #f8fbfa; + --surface-soft: #edf5f2; + --surface-muted: #dce9e4; + --border: #b9cbc4; + --border-strong: #769186; + --hairline: rgba(7, 18, 15, 0.08); + --text: #14211d; + --text-strong: #07110e; + --muted: #5e7069; + --muted-soft: #879a93; + --primary: #e63857; + --primary-hover: #c72543; + --primary-soft: #fff0f3; + --primary-border: #efa2b2; + --primary-accent-text: #9b1530; + --secondary: #0c9181; + --secondary-soft: #e2f6f2; + --secondary-border: #83cec3; + --success: #147d55; + --success-soft: #e8f7ef; + --warning: #af7216; + --warning-soft: #fff4e3; + --warning-border: #e7be78; + --danger: #c32c46; + --danger-hover: #a11e34; + --danger-soft: #fff0f3; + --danger-border: #f0a7b6; + --header-bg: rgba(248, 251, 250, 0.94); + --hover-border: #557f75; + --chart-track: #d5e2dd; + --preview-bg: #f1f7f4; + --shadow: 0 22px 46px rgba(0, 0, 0, 0.26), 0 1px 0 rgba(255, 255, 255, 0.82) inset; + --shadow-soft: 0 9px 22px rgba(0, 0, 0, 0.17), 0 1px 0 rgba(255, 255, 255, 0.82) inset; + --focus-ring: 0 0 0 3px rgba(12, 145, 129, 0.22), 0 0 0 6px rgba(230, 56, 87, 0.10); + color-scheme: light; +} + +* { + letter-spacing: 0; +} + +body { + overflow-x: hidden; + color: var(--text); + background: + linear-gradient(135deg, rgba(244, 63, 94, 0.06), transparent 30%), + linear-gradient(225deg, rgba(15, 159, 142, 0.08), transparent 35%), + repeating-linear-gradient(90deg, rgba(20, 33, 29, 0.035) 0 1px, transparent 1px 72px), + repeating-linear-gradient(0deg, rgba(20, 33, 29, 0.03) 0 1px, transparent 1px 72px), + var(--bg); + font-family: var(--font-ui); +} + +:root[data-theme="dark"] body { + background: + linear-gradient(135deg, rgba(244, 63, 94, 0.12), transparent 32%), + linear-gradient(225deg, rgba(15, 159, 142, 0.16), transparent 38%), + repeating-linear-gradient(90deg, rgba(238, 244, 241, 0.04) 0 1px, transparent 1px 76px), + repeating-linear-gradient(0deg, rgba(238, 244, 241, 0.035) 0 1px, transparent 1px 76px), + var(--bg); +} + +.mono, +.log, +.appFooter, +.btn[data-kbd]::after, +.premiumDeviceRow em { + font-family: var(--font-mono); +} + +.app { + display: grid; + grid-template-columns: minmax(270px, 318px) minmax(0, 1fr); + grid-template-areas: + "top overview" + "rail workspace" + "footer footer"; + gap: var(--shell-gap); + width: min(var(--page-max), 100%); + min-height: 100vh; + padding: var(--page-pad); +} + +#topTemplatesMount { + display: contents; +} + +.header { + grid-area: top; + position: sticky; + top: 10px; + z-index: 30; + display: block; + padding: 18px 16px; + border: 1px solid var(--border); + border-radius: 8px; + background: var(--header-bg); + box-shadow: var(--shadow-soft); + backdrop-filter: blur(14px) saturate(1.05); +} + +.header::before, +.header::after { + display: none; +} + +.brandBlock { + align-items: flex-start; + min-width: 0; + gap: 10px; +} + +.brandMark { + flex-basis: 40px; + width: 40px; + height: 40px; + border: 1px solid color-mix(in oklab, var(--primary) 45%, var(--secondary)); + border-radius: 8px; + background: linear-gradient(135deg, var(--primary), #f08b38 48%, var(--secondary)); + box-shadow: 0 8px 18px -12px var(--primary); +} + +.brandMark svg { + width: 22px; + height: 22px; +} + +.title { + color: var(--text-strong); + font-size: 21px; + font-weight: 800; + line-height: 1.15; +} + +.subtitle { + margin-top: 3px; + color: var(--muted); + font-size: 13px; + font-weight: 600; +} + +.header-actions { + display: grid; + grid-template-columns: 1fr; + gap: 8px; + margin-top: 16px; + justify-content: stretch; +} + +.actionGroup { + display: grid; + grid-auto-flow: row; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 6px; + min-width: 0; +} + +.primaryActions { + grid-template-columns: 1fr 1fr; +} + +.primaryActions #btnForceStop { + grid-column: 1 / -1; +} + +.secondaryActions { + grid-template-columns: repeat(2, minmax(0, 1fr)); +} + +#btnSave { + grid-column: 1 / -1; +} + +#btnTheme { + width: 100%; + margin-left: 0; +} + +.secondaryActions::before { + display: none; +} + +.btn { + min-width: 0; + border-radius: 8px; + font-size: 14px; + font-weight: 800; + background: var(--surface-soft); + box-shadow: none; + transition: transform var(--motion-fast), border-color var(--motion-fast), background var(--motion-fast), color var(--motion-fast); +} + +.btn:hover { + transform: translateY(-1px); + border-color: var(--hover-border); + background: var(--surface); +} + +.btn:active { + transform: scale(0.98); +} + +.btnPrimary { + color: #ffffff; + border-color: transparent; + background: linear-gradient(135deg, var(--primary), #f06e31); + box-shadow: 0 10px 22px -14px var(--primary); +} + +.btnPrimary:hover { + color: #ffffff; + background: linear-gradient(135deg, var(--primary-hover), #df7b20); +} + +.btnDanger { + color: #ffffff; + background: linear-gradient(135deg, var(--danger), #a92339); +} + +.btnDangerSoft { + color: var(--danger); + border-color: var(--danger-border); + background: var(--danger-soft); +} + +.btnGhost, +.btnSoft { + color: var(--text-strong); + border-color: var(--border); + background: var(--surface-soft); +} + +.btn:disabled, +.btn[disabled], +.btn.isDisabled { + cursor: not-allowed; + color: var(--muted-soft); + border-color: var(--border); + background: color-mix(in oklab, var(--surface-muted) 72%, var(--surface)); + box-shadow: none; + opacity: 0.74; + transform: none; +} + +.overview { + grid-area: overview; + display: grid; + grid-template-columns: minmax(190px, 1.15fr) repeat(3, minmax(150px, 1fr)); + gap: var(--overview-gap); + margin: 0; +} + +.overviewCard { + min-height: 86px; + padding: 14px 16px; + border: 1px solid var(--border); + border-radius: 8px; + background: var(--surface); + box-shadow: var(--shadow-soft); +} + +.overviewCard::before { + top: 12px; + bottom: 12px; + width: 3px; + background: var(--border-strong); +} + +.overviewCard::after { + display: none; +} + +.overviewCard:hover { + transform: none; + border-color: var(--hover-border); + box-shadow: var(--shadow-soft); +} + +.overviewPrimary { + min-height: 86px; + border-color: var(--secondary-border); + background: + linear-gradient(90deg, color-mix(in oklab, var(--secondary) 8%, transparent), transparent 70%), + var(--surface); +} + +.overviewPrimary::before { + background: linear-gradient(180deg, var(--primary), var(--secondary)); +} + +.overviewLabel { + color: var(--muted); + font-size: 11px; + font-weight: 800; + letter-spacing: 0.08em; +} + +.overviewValue { + margin-top: 8px; + color: var(--text-strong); + font-size: 28px; + font-weight: 800; + line-height: 1; +} + +.overviewMeta { + margin-top: 5px; + color: var(--muted); + font-size: 12px; +} + +.overviewSpark { + height: 16px; + margin-top: 5px; +} + +.workspaceShell { + display: contents; +} + +.configRail { + grid-area: rail; + position: sticky; + top: 232px; + align-self: start; + max-height: calc(100vh - 108px); + overflow: auto; + padding: 16px; + border: 1px solid var(--border); + border-radius: 8px; + background: var(--surface); + box-shadow: var(--shadow-soft); +} + +.configRail::before { + display: none; +} + +.cardTitle { + margin-bottom: 10px; + padding-bottom: 12px; + color: var(--text-strong); + font-size: 17px; + font-weight: 800; +} + +.cardTitle::after { + height: 20px; + color: var(--muted); + border-color: var(--border); + background: var(--surface-soft); +} + +.cardTitle .sectionIcon { + border-color: var(--primary-border); + background: var(--primary-soft); + color: var(--primary); +} + +.sideNav { + display: grid; + gap: 4px; + margin-top: 8px; + padding: 8px; + border: 1px solid var(--border); + border-radius: 8px; + background: var(--surface-soft); + box-shadow: none; +} + +.sideNav::before { + display: none; +} + +.tabBtn { + min-height: 40px; + padding: 0 10px; + border-radius: 8px; + color: var(--muted); + font-size: 14px; + font-weight: 800; +} + +.tabBtn::before { + width: 28px; + margin-right: 4px; + color: var(--muted-soft); + font-size: 10px; + letter-spacing: 0.08em; +} + +.tabBtn::after { + right: 8px; + background: var(--secondary); + box-shadow: none; +} + +.tabBtn:hover, +.tabBtn.active { + color: var(--text-strong); + border-color: var(--secondary-border); + background: var(--secondary-soft); + box-shadow: none; +} + +.tabBtn.active::before, +.tabBtn.active .tabIcon, +.tabBtn:hover .tabIcon { + color: var(--secondary); +} + +.configWorkspace { + grid-area: workspace; + min-width: 0; +} + +.workspaceHeader { + display: grid; + grid-template-columns: minmax(260px, 1fr) minmax(280px, 420px); + align-items: center; + gap: 16px; + margin-bottom: 12px; + padding: 16px 18px; + border: 1px solid var(--border); + border-radius: 8px; + background: var(--surface); + box-shadow: var(--shadow-soft); +} + +.workspaceHeader::before { + top: 14px; + bottom: 14px; + width: 3px; + background: linear-gradient(180deg, var(--primary), var(--secondary)); +} + +.workspaceHeader::after { + display: none; +} + +.workspaceEyebrow { + color: var(--secondary); + font-size: 11px; + font-weight: 800; + letter-spacing: 0.16em; +} + +.workspaceTitle { + margin-top: 4px; + color: var(--text-strong); + font-size: 30px; + font-weight: 900; + letter-spacing: 0; +} + +.workspaceSearch { + width: 100%; +} + +.workspaceSearch input, +.input, +.small, +.logSearchBox { + color: var(--text); + border-color: var(--border); + background: var(--surface); + font-weight: 700; +} + +.workspaceSearch input:focus-visible, +.input:focus-visible, +.small:focus-visible, +.logSearchBox:focus-visible { + border-color: var(--secondary); + background: #ffffff; + box-shadow: var(--focus-ring); +} + +.panels { + width: 100%; + max-width: none; +} + +.panel, +.card[data-panel] { + width: 100%; + padding: 20px 22px; + border: 1px solid var(--border); + border-radius: 8px; + background: var(--surface); + box-shadow: var(--shadow-soft); +} + +.panel::before, +.card::before, +.chartBlock::before { + display: none; +} + +.panel.active { + animation: panelReflowIn 180ms cubic-bezier(0.16, 1, 0.3, 1); +} + +.panel.isPremiumPulse { + animation: panelReflowIn 180ms cubic-bezier(0.16, 1, 0.3, 1); +} + +@keyframes panelReflowIn { + from { opacity: 0; transform: translateY(4px); } + to { opacity: 1; transform: translateY(0); } +} + +.sectionTitle { + position: static; + margin: 18px 0 10px; + padding: 0 0 8px; + color: var(--secondary); + border-bottom: 1px solid var(--border); + background: transparent; + font-size: 12px; + font-weight: 800; + letter-spacing: 0.12em; +} + +.sectionTitle::before { + min-width: 34px; + height: 19px; + border-color: var(--secondary-border); + background: var(--secondary-soft); + color: var(--secondary); +} + +.sectionTitle::after { + background: linear-gradient(90deg, var(--secondary-border), transparent); +} + +.panel > .sectionTitle:first-child { + margin-top: 0; +} + +.panel > .row { + margin-top: 10px; + padding: 0; + border: 0; + background: transparent; +} + +.panel > .row:hover, +.panel > .row:focus-within { + transform: none; + background: transparent; +} + +.row.grid2, +.row.grid3 { + gap: 12px; +} + +.label { + color: var(--text-strong); + font-size: 14px; + font-weight: 800; +} + +.hint { + color: var(--muted); +} + +.check { + border-color: var(--border); + background: var(--surface-soft); + font-weight: 700; +} + +.check:has(input[type="checkbox"]:checked) { + border-color: var(--secondary-border); + background: var(--secondary-soft); +} + +.check.isToggle input[type="checkbox"]:checked { + background: linear-gradient(90deg, var(--primary), var(--secondary)); +} + +.btnGroup { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +.btnGroup > .btn, +.btnGroup > .btn:first-child, +.btnGroup > .btn:last-child { + flex: 0 1 auto; + min-width: 128px; + margin-left: 0; + border-radius: 8px; +} + +.statsGrid { + grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); + gap: 12px; +} + +.stat { + padding: 14px 16px; + border-color: var(--border); + background: var(--surface-soft); + box-shadow: none; +} + +.stat:hover { + border-color: var(--secondary-border); + background: var(--surface); + box-shadow: var(--shadow-soft); + transform: none; +} + +.statLabel { + color: var(--muted); + font-size: 11px; + font-weight: 800; + letter-spacing: 0.08em; +} + +.statValue { + color: var(--text-strong); + font-weight: 800; +} + +.chartBlock { + border-color: var(--border); + background: var(--surface-soft); + box-shadow: none; +} + +.chartBlock:hover { + border-color: var(--secondary-border); + background: var(--surface); + box-shadow: var(--shadow-soft); + transform: none; +} + +.chartTitle { + color: var(--text-strong); +} + +.barFill { + background: linear-gradient(90deg, var(--secondary), var(--primary)); +} + +.preview { + border-color: var(--border); + background: + repeating-linear-gradient(0deg, rgba(20, 33, 29, 0.04) 0 1px, transparent 1px 14px), + var(--preview-bg); + box-shadow: none; +} + +.preview::after { + display: none; +} + +.previewBracket { + border-color: var(--secondary); +} + +.table { + border-color: var(--border); + background: var(--surface); +} + +.tableHead { + color: var(--secondary); + background: var(--secondary-soft); +} + +.tableRow:not(.tableHead):hover { + background: var(--surface-soft); +} + +.logSection { + border-color: var(--border); + border-radius: 8px; + background: var(--surface); + box-shadow: none; +} + +.logHeader { + align-items: center; + border-bottom-color: var(--border); + background: var(--surface-soft); +} + +.logTitle { + color: var(--text-strong); + font-weight: 900; + letter-spacing: 0; +} + +.logTitle::after { + color: var(--muted); + border-color: var(--border); + background: var(--surface); +} + +.logHeaderActions { + align-items: center; + gap: 8px; +} + +.logHeaderActions .small { + flex: 0 0 94px; +} + +.logHeaderActions .logSearchBox { + flex: 1 1 280px; +} + +.log { + min-height: clamp(300px, 42vh, 520px); + max-height: clamp(300px, 42vh, 520px); + border-top-color: var(--border); + color: #12231e; + background: + linear-gradient(180deg, rgba(15, 159, 142, 0.04), transparent 44px), + repeating-linear-gradient(0deg, rgba(20, 33, 29, 0.045) 0 1px, transparent 1px 25px), + #f8fbfa; + font-size: 13px; + line-height: 1.65; + overflow-wrap: normal; + white-space: pre; + tab-size: 2; + text-shadow: none; +} + +:root[data-theme="dark"] .log { + color: #12231e; + background: + linear-gradient(180deg, rgba(15, 159, 142, 0.05), transparent 44px), + repeating-linear-gradient(0deg, rgba(20, 33, 29, 0.05) 0 1px, transparent 1px 25px), + #f8fbfa; +} + +.log::after { + display: none; +} + +.log::-webkit-scrollbar-thumb { + background: var(--border-strong); + border-color: #f8fbfa; +} + +.panel.cardLog .log { + min-height: clamp(470px, 60vh, 760px); + max-height: clamp(470px, 60vh, 760px); +} + +.logError { color: var(--danger); } +.logWarn { color: var(--warning); } +.logSuccess { color: var(--success); } +.logInfo { color: #12231e; } +.logDebug { color: #6b7d76; } + +.reservationItem { + border-color: var(--border); + background: var(--surface); + box-shadow: none; +} + +.reservationItem:hover { + transform: none; + border-color: var(--secondary-border); + background: var(--surface-soft); + box-shadow: none; +} + +.appFooter { + grid-area: footer; + margin-top: 0; + border-top-color: var(--border); + background: color-mix(in oklab, var(--surface) 72%, transparent); +} + +.premiumReplica { + display: none; +} + +/* SaaS dashboard layout: centered app shell, top nav, left config forms, right analytics. */ +@media (min-width: 1121px) { + body { + min-height: 100vh; + background: + linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(241, 245, 249, 0.96)), + var(--bg); + font-size: 12px; + } + + .app { + grid-template-columns: minmax(600px, 1.08fr) minmax(408px, 0.92fr); + grid-template-rows: auto auto minmax(0, 1fr) auto; + grid-template-areas: + "top top" + "rail rail" + "workspace overview" + "footer footer"; + gap: 0; + width: min(1320px, calc(100% - 48px)); + min-height: auto; + margin: clamp(28px, 6vh, 78px) auto; + padding: 14px; + border: 1px solid rgba(15, 23, 42, 0.08); + border-radius: 0; + background: #ffffff; + box-shadow: 0 28px 70px rgba(15, 23, 42, 0.13); + overflow: hidden; + font-family: var(--font-ui); + } + + :root[data-premium-panel="runLogs"] .app, + :root[data-premium-panel="actionLogs"] .app, + :root[data-premium-panel="stats"] .app, + :root[data-premium-panel="monitor"] .app, + :root[data-premium-panel="reservations"] .app { + grid-template-columns: 1fr; + grid-template-areas: + "top" + "rail" + "workspace" + "footer"; + } + + .header { + position: static; + display: flex; + align-items: center; + justify-content: space-between; + gap: 14px; + min-height: 0; + padding: 2px 8px 13px; + border: 0; + border-bottom: 1px solid var(--border); + border-radius: 0; + background: transparent; + box-shadow: none; + backdrop-filter: none; + } + + .brandBlock { + align-items: center; + flex: 0 0 auto; + gap: 10px; + } + + .brandMark { + flex-basis: 32px; + width: 32px; + height: 32px; + border: 1px solid rgba(15, 23, 42, 0.1); + border-radius: 8px; + color: #ffffff; + background: + radial-gradient(circle at 72% 28%, #28f4ff 0 18%, transparent 19%), + radial-gradient(circle at 28% 70%, #ff2b5d 0 22%, transparent 23%), + linear-gradient(135deg, #101322, #111827); + box-shadow: 0 9px 18px rgba(15, 23, 42, 0.16); + } + + .brandMark svg { + width: 19px; + height: 19px; + filter: drop-shadow(1px 1px 0 rgba(255, 43, 93, 0.9)); + } + + .title { + font-size: 19px; + font-weight: 850; + line-height: 1.05; + } + + .subtitle { + display: inline-flex; + align-items: center; + min-height: 18px; + margin-top: 0; + padding: 0 7px; + border: 1px solid #d9dff0; + border-radius: 5px; + color: #667085; + background: #f3f5fb; + font-size: 10px; + font-weight: 700; + } + + .header-actions { + display: flex; + flex: 1 1 auto; + justify-content: flex-end; + gap: 6px; + margin-top: 0; + } + + .primaryActions, + .secondaryActions { + display: flex; + grid-template-columns: none; + gap: 7px; + min-width: 0; + } + + .primaryActions #btnForceStop, + #btnSave { + grid-column: auto; + } + + .header .btn { + min-height: 32px; + padding: 0 9px; + border-radius: 7px; + font-size: 11px; + font-weight: 700; + white-space: nowrap; + } + + .header .btnPrimary { + border-color: #dedffb; + color: #574ce7; + background: #f5f4ff; + box-shadow: none; + } + + .header .btnDanger, + .header .btnDangerSoft, + .header .btnSoft, + .header .btnGhost { + border-color: #e5e8f0; + color: #475467; + background: #ffffff; + box-shadow: none; + } + + .header .btnIcon { + width: 14px; + height: 14px; + } + + #btnTheme { + min-width: 34px; + width: 34px; + padding: 0; + } + + .configRail { + position: static; + max-height: none; + padding: 0 8px; + border: 0; + border-bottom: 1px solid var(--border); + border-radius: 0; + background: #ffffff; + box-shadow: none; + overflow: visible; + } + + .workspaceShell .configRail { + position: static; + top: auto; + align-self: stretch; + } + + .configRail .cardTitle { + display: none; + } + + .sideNav { + display: flex; + flex-direction: row; + align-items: stretch; + justify-content: center; + gap: 14px; + height: 44px; + margin-top: 0; + padding: 0; + border: 0; + border-radius: 0; + background: transparent; + overflow-x: auto; + overflow-y: hidden; + counter-reset: tabIdx; + } + + .sideNav .tabBtn { + position: relative; + display: inline-flex; + align-items: center; + justify-content: center; + flex: 0 0 auto; + width: auto; + max-width: none; + min-width: 0; + min-height: 44px; + padding: 0 4px; + gap: 6px; + border: 0; + border-bottom: 2px solid transparent; + border-radius: 0; + background: transparent; + box-shadow: none; + color: #5b6474; + } + + .sideNav .tabBtn::before { + display: none; + } + + .sideNav .tabIcon { + margin: 0; + } + + .sideNav .tabText { + display: inline; + overflow: visible; + max-width: none; + text-align: left; + font-size: 13px; + line-height: 1; + white-space: nowrap; + text-overflow: clip; + } + + .sideNav .tabBtn:hover, + .sideNav .tabBtn.active { + color: #5f52e8; + border-color: #6d5dfc; + background: transparent; + } + + .overview { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + align-self: stretch; + align-content: start; + gap: 8px; + margin: 0; + padding: 12px 6px 0 10px; + overflow: visible; + } + + :root:not([data-premium-panel="device"]) .overview { + display: none; + } + + .overview::before { + display: none; + } + + .overviewCard { + min-height: 78px; + padding: 11px 12px; + border-color: #edf0f6; + background: linear-gradient(135deg, #ffffff, #f9faff); + box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04); + } + + .overviewPrimary { + min-height: 78px; + background: linear-gradient(135deg, #ffffff, #f5f3ff); + } + + .overviewValue { + margin-top: 6px; + color: #101936; + font-size: 24px; + font-weight: 850; + line-height: 1.05; + } + + .overviewLabel { + color: #667085; + font-size: 11px; + font-weight: 700; + } + + .overviewMeta { + color: #7a8496; + font-size: 10px; + font-weight: 600; + } + + .premiumDashboard { + grid-column: 1 / -1; + display: grid; + gap: 10px; + } + + .premiumDashCard { + padding: 13px 14px; + border: 1px solid #edf0f6; + border-radius: 8px; + background: #ffffff; + box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04); + } + + .premiumDashHead { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; + margin-bottom: 10px; + } + + .premiumDashTitle { + color: #111827; + font-size: 14px; + font-weight: 900; + } + + .premiumDashTools { + display: flex; + gap: 6px; + } + + .premiumDashTools span, + .premiumDashCount { + padding: 4px 7px; + border: 1px solid #e7eaf1; + border-radius: 6px; + color: #6b7280; + background: #fbfcff; + font-size: 11px; + font-weight: 800; + } + + .premiumTrendSvg { + width: 100%; + height: 150px; + } + + .premiumTrendGrid { + fill: none; + stroke: #eef1f7; + stroke-dasharray: 3 5; + } + + .premiumTrendArea { + fill: url(#premiumTrendFill); + } + + .premiumTrendLine { + fill: none; + stroke: #6d5dfc; + stroke-width: 3; + stroke-linecap: round; + } + + .premiumTrendGhost { + fill: none; + stroke: #b8c0d4; + stroke-width: 2; + stroke-dasharray: 5 7; + stroke-linecap: round; + } + + .premiumDeviceTable, + .premiumLatestLogs { + display: grid; + gap: 0; + } + + .premiumDeviceRow, + .premiumLogRow { + display: grid; + align-items: center; + min-height: 30px; + border-bottom: 1px solid #eef1f7; + color: #4b5563; + font-size: 11px; + font-family: var(--font-ui); + } + + .premiumDeviceRow { + grid-template-columns: 70px minmax(0, 1fr) 44px; + gap: 8px; + } + + .premiumDeviceRow b { + overflow: hidden; + color: #111827; + font-weight: 800; + text-overflow: ellipsis; + white-space: nowrap; + } + + .premiumDeviceRow em { + color: #16a66a; + font-style: normal; + font-weight: 900; + } + + .premiumLogRow { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .premiumLinkBtn { + border: 0; + color: #6d5dfc; + background: transparent; + font-size: 11px; + font-weight: 900; + cursor: pointer; + } + + .configWorkspace { + display: grid; + grid-template-rows: minmax(0, 1fr); + gap: 0; + padding: 12px 10px 0 6px; + max-height: 734px; + overflow: auto; + scrollbar-gutter: stable; + } + + :root:not([data-premium-panel="device"]) .configWorkspace { + max-height: none; + padding-right: 6px; + overflow: visible; + } + + .workspaceHeader { + display: none; + } + + .premiumReplica { + display: none; + } + + :root[data-premium-panel="device"] .premiumReplica { + display: grid; + gap: 8px; + } + + :root[data-premium-panel="device"] .configWorkspace > .panels { + display: none !important; + } + + .premiumConfigCard { + min-width: 0; + padding: 11px 14px 10px; + border: 1px solid #eceff6; + border-radius: 8px; + background: #ffffff; + box-shadow: 0 8px 22px rgba(15, 23, 42, 0.035); + opacity: 1 !important; + transform: none !important; + animation: none !important; + } + + .premiumConfigHead { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; + margin-bottom: 10px; + color: #111827; + font-size: 14px; + font-weight: 850; + line-height: 1; + } + + .premiumConfigHead > div { + display: inline-flex; + align-items: center; + min-width: 0; + gap: 8px; + } + + .premiumSectionIcon { + display: inline-grid; + place-items: center; + width: 18px; + height: 18px; + color: #695cff; + font-size: 13px; + } + + .premiumGrid2, + .premiumGrid5, + .premiumGrid6 { + display: grid; + align-items: end; + gap: 8px 12px; + min-width: 0; + } + + .premiumGrid2 { + grid-template-columns: minmax(170px, 0.36fr) minmax(260px, 0.64fr); + } + + .premiumGrid5 { + grid-template-columns: repeat(5, minmax(0, 1fr)); + } + + .premiumGrid6 { + grid-template-columns: repeat(6, minmax(0, 1fr)); + } + + .premiumConnectionGrid { + grid-template-columns: 72px 72px minmax(220px, 1.9fr) minmax(92px, 0.75fr) minmax(92px, 0.75fr); + margin-top: 10px; + } + + .premiumWide { + min-width: 0; + } + + .premiumField, + .premiumRadio, + .premiumSwitch, + .premiumChecks label { + font-family: var(--font-ui); + } + + .premiumField { + display: grid; + min-width: 0; + gap: 5px; + color: #475467; + font-size: 11px; + font-weight: 700; + } + + .premiumField span { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .premiumField input, + .premiumField select { + width: 100%; + min-width: 0; + height: 32px; + padding: 0 12px; + border: 1px solid #dfe4ef; + border-radius: 6px; + color: #253044; + background: #ffffff; + font-family: var(--font-ui); + font-size: 12px; + font-weight: 600; + outline: none; + box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02); + } + + .premiumField input:focus, + .premiumField select:focus { + border-color: #7568ff; + box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.12); + } + + .premiumRadio { + display: inline-flex; + align-items: center; + height: 32px; + gap: 6px; + color: #344054; + font-size: 12px; + font-weight: 700; + white-space: nowrap; + } + + .premiumRadio input { + width: 13px; + height: 13px; + accent-color: #6657f5; + } + + .premiumSwitch { + display: inline-flex; + align-items: center; + justify-content: flex-end; + gap: 8px; + color: #475467; + font-size: 12px; + font-weight: 700; + white-space: nowrap; + } + + .premiumSwitch input { + position: absolute; + opacity: 0; + pointer-events: none; + } + + .premiumSwitch span { + position: relative; + display: inline-block; + width: 32px; + height: 18px; + border-radius: 999px; + background: #d8dde8; + box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.04); + } + + .premiumSwitch span::after { + content: ""; + position: absolute; + top: 3px; + left: 3px; + width: 12px; + height: 12px; + border-radius: 50%; + background: #ffffff; + box-shadow: 0 1px 3px rgba(15, 23, 42, 0.24); + transition: transform 120ms ease; + } + + .premiumSwitch input:checked + span { + background: linear-gradient(135deg, #6d5dfc, #5a4be7); + } + + .premiumSwitch input:checked + span::after { + transform: translateX(14px); + } + + .premiumInline { + justify-content: flex-start; + min-height: 32px; + align-self: end; + } + + .premiumChecks { + display: flex; + flex-wrap: wrap; + gap: 10px 22px; + margin-top: 10px; + color: #475467; + font-size: 12px; + font-weight: 700; + } + + .premiumChecks label { + display: inline-flex; + align-items: center; + gap: 6px; + min-height: 22px; + white-space: nowrap; + } + + .premiumChecks input { + width: 13px; + height: 13px; + accent-color: #6254ef; + } + + .premiumConfigActions { + display: grid; + grid-template-columns: 118px 132px minmax(0, 1fr) 118px; + align-items: center; + gap: 10px; + padding: 8px 0 1px; + } + + .premiumPrimaryBtn, + .premiumGhostBtn { + height: 34px; + border-radius: 6px; + font-family: var(--font-ui); + font-size: 12px; + font-weight: 800; + cursor: pointer; + } + + .premiumPrimaryBtn { + border: 1px solid #6254ef; + color: #ffffff; + background: linear-gradient(135deg, #6d5dfc, #5a4be7); + box-shadow: 0 8px 16px rgba(109, 93, 252, 0.18); + } + + .premiumGhostBtn { + border: 1px solid #dfe4ef; + color: #6254ef; + background: #ffffff; + } + + .premiumGrid6 > .premiumGhostBtn { + align-self: end; + width: 100%; + } + + .premiumResetBtn { + grid-column: 4; + color: #475467; + } + + .premiumPrimaryBtn:hover, + .premiumGhostBtn:hover { + transform: none; + filter: brightness(0.98); + } + + .panels { + display: block; + gap: 8px; + min-height: 0; + } + + :root[data-premium-panel="device"] .panel[data-panel="run"][hidden], + :root[data-premium-panel="device"] .panel[data-panel="filter"][hidden], + :root[data-premium-panel="device"] .panel[data-panel="reservations"][hidden], + :root[data-premium-panel="device"] .panel[data-panel="yanghao"][hidden] { + display: none !important; + } + + :root[data-premium-panel="device"] .panel[data-panel="device"], + :root[data-premium-panel="device"] .panel[data-panel="run"], + :root[data-premium-panel="device"] .panel[data-panel="filter"], + :root[data-premium-panel="device"] .panel[data-panel="reservations"], + :root[data-premium-panel="device"] .panel[data-panel="yanghao"] { + height: auto; + margin-bottom: 8px; + display: none !important; + } + + :root[data-premium-panel="device"] .panel[data-panel="device"] > :nth-child(n+6), + :root[data-premium-panel="device"] .panel[data-panel="run"] > :nth-child(n+5), + :root[data-premium-panel="device"] .panel[data-panel="filter"] > :nth-child(n+7), + :root[data-premium-panel="device"] .panel[data-panel="yanghao"] > :nth-child(n+4), + :root[data-premium-panel="device"] .panel[data-panel="reservations"] .divider, + :root[data-premium-panel="device"] .panel[data-panel="reservations"] details { + display: none !important; + } + + .panel, + .card[data-panel] { + min-height: 0; + padding: 0; + border: 0; + background: transparent; + box-shadow: none; + overflow: visible; + } + + :root:not([data-premium-panel="device"]) .panel, + :root:not([data-premium-panel="device"]) .card[data-panel] { + padding: 0; + border: 0; + background: transparent; + } + + .panel > .sectionTitle { + margin: 8px 0 0; + padding: 13px 14px 9px; + border: 1px solid #edf0f6; + border-bottom: 0; + border-radius: 8px 8px 0 0; + background: #ffffff; + } + + .panel > .sectionTitle:first-child { + margin-top: 8px; + } + + .panel > .row, + .panel > .rowActions { + margin-top: 0; + padding: 10px 14px; + border-right: 1px solid #edf0f6; + border-left: 1px solid #edf0f6; + background: #ffffff; + } + + .panel > .row { + display: grid; + } + + .panel > .rowActions, + .panel > .row:last-child { + border-bottom: 1px solid #edf0f6; + border-radius: 0 0 8px 8px; + } + + .panel.cardLog .log { + min-height: 470px; + max-height: 470px; + } + + :root:not([data-premium-panel="device"]) .panel.cardLog .log { + min-height: 520px; + max-height: 520px; + } + + .appFooter { + padding: 10px 8px 0; + border-top: 0; + background: transparent; + } +} + +.premiumReveal { + animation: reflowReveal 220ms cubic-bezier(0.16, 1, 0.3, 1) both; + animation-delay: calc(var(--stagger, 0) * 24ms); +} + +@keyframes reflowReveal { + from { opacity: 0; transform: translateY(5px); } + to { opacity: 1; transform: translateY(0); } +} + +@media (max-width: 1120px) { + .premiumReplica { + display: none; + } + + .app { + grid-template-columns: 1fr; + grid-template-areas: + "top" + "overview" + "rail" + "workspace" + "footer"; + } + + .header { + position: relative; + top: 0; + } + + .header-actions { + grid-template-columns: 1fr; + } + + .primaryActions, + .secondaryActions { + grid-auto-flow: column; + grid-template-columns: none; + grid-auto-columns: minmax(0, 1fr); + } + + .primaryActions #btnForceStop, + #btnSave { + grid-column: auto; + } + + .configRail { + position: static; + max-height: none; + } + + .sideNav { + display: flex; + flex-direction: row; + overflow-x: auto; + } + + .tabBtn { + flex: 0 0 auto; + width: auto; + min-width: 116px; + } +} + +@media (max-width: 760px) { + :root { + --page-pad: 10px; + --overview-gap: 8px; + } + + .app { + gap: 10px; + } + + .header { + padding: 12px; + } + + .brandMark { + flex-basis: 38px; + width: 38px; + height: 38px; + } + + .title { + font-size: 20px; + } + + .subtitle { + display: none; + } + + .actionGroup { + grid-auto-flow: row; + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .overview { + grid-template-columns: 1fr; + } + + .overviewCard { + min-height: 82px; + } + + .overviewValue { + font-size: 24px; + } + + .workspaceHeader { + grid-template-columns: 1fr; + padding: 14px; + } + + .workspaceTitle { + font-size: 27px; + } + + .panel, + .card[data-panel], + .configRail { + padding: 14px; + } + + .row.grid2, + .row.grid3, + .inline2 { + grid-template-columns: 1fr; + } + + .btnGroup { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + width: 100%; + } + + .btnGroup > .btn, + .btnGroup > .btn:first-child, + .btnGroup > .btn:last-child { + min-width: 0; + width: 100%; + } + + .logHeader { + align-items: stretch; + } + + .logHeaderActions { + display: grid; + grid-template-columns: 104px 1fr; + width: 100%; + } + + .logHeaderActions .small, + .logHeaderActions .btn.small { + width: 100%; + min-width: 0; + } + + .logHeaderActions .logSearchBox { + grid-column: 1 / -1; + width: 100%; + min-width: 0; + } + + .panel.cardLog .log, + .log { + min-height: clamp(360px, 56vh, 620px); + max-height: clamp(360px, 56vh, 620px); + } + + .toastContainer { + right: 10px; + bottom: 56px; + left: 10px; + max-width: none; + } + + .toast { + grid-template-columns: 22px minmax(0, 1fr) 22px; + } + + .appFooter { + flex-direction: row; + align-items: center; + justify-content: flex-start; + min-height: 44px; + padding: 10px 12px; + gap: 8px; + overflow: hidden; + font-size: 11px; + letter-spacing: 0.06em; + } + + .appFooterLeft { + min-width: 0; + flex-wrap: nowrap; + gap: 8px; + } + + .appFooterRight, + .appFooterDivider { + display: none; + } + + .appConnText, + .appFooterMeta { + white-space: nowrap; + } +} + +@media (max-width: 430px) { + .actionGroup, + .btnGroup { + grid-template-columns: 1fr 1fr; + } + + .overview { + grid-template-columns: 1fr; + } + + .tableRow { + grid-template-columns: 1fr; + } +} + +@media (prefers-reduced-motion: reduce) { + .premiumReveal, + .panel.active, + .panel.isPremiumPulse { + animation: none; + } + + .btn:hover { + transform: none; + } +} diff --git a/webui/index.html b/webui/index.html index 163af19..fbba876 100644 --- a/webui/index.html +++ b/webui/index.html @@ -8,134 +8,24 @@ - + + + + +
-
-
- -
-
抖音挂机控制台
-
设备调度 · 运行控制 · 实时观察
-
-
-
-
- - - -
-
- - - - - - -
-
-
- -
-
-
运行状态
-
- - 等待启动 -
-
PID - / 运行时长 -
-
-
-
设备连接
-
未刷新
-
ADB 状态待检测
-
-
-
福袋处理
-
0 / 0
-
打开详情 / 成功参与
- -
-
-
日志缓存
-
-
-
最后日志 -
-
-
+
- - - +
- - - - - - - +
- +
+ + + @@ -1291,8 +838,13 @@ + + + + + diff --git a/webui/js/config_panel_templates.js b/webui/js/config_panel_templates.js new file mode 100644 index 0000000..a676309 --- /dev/null +++ b/webui/js/config_panel_templates.js @@ -0,0 +1,265 @@ +// Config panel HTML templates split from index.html. +(function mountConfigPanelTemplates() { + const mount = document.getElementById("configPanelTemplatesMount"); + if (!mount) return; + mount.innerHTML = ` + + + + `; +})(); diff --git a/webui/js/log_views.js b/webui/js/log_views.js index 97e45dd..cc29ebb 100644 --- a/webui/js/log_views.js +++ b/webui/js/log_views.js @@ -3,7 +3,8 @@ function classifyLogLine(line) { const s = String(line || ""); if (!s) return ""; // 错误优先 - if (/\b(ERROR|FATAL|CRITICAL|TRACEBACK|EXCEPTION|FAILED|FAIL\b)\b/i.test(s)) return "logError"; + if (/\b(ERROR|FATAL|CRITICAL|TRACEBACK|EXCEPTION|FAILED)\b/i.test(s)) return "logError"; + if (/(^|[\s::\[])(FAIL|FAILURE)(?=$|[\s\]))])/.test(s.toUpperCase())) return "logError"; if (/(失败|错误|异常|未知错误|超时|崩溃)/.test(s)) return "logError"; if (/❌/.test(s)) return "logError"; // 警告 diff --git a/webui/js/panel_templates.js b/webui/js/panel_templates.js new file mode 100644 index 0000000..aded07d --- /dev/null +++ b/webui/js/panel_templates.js @@ -0,0 +1,125 @@ +// Panel/footer HTML templates split from index.html to keep markup maintainable. +(function mountPanelTemplates() { + const panelMount = document.getElementById("panelTemplatesMount"); + if (panelMount) { + panelMount.innerHTML = ` + + + + + + + + `; + } + + const footerMount = document.getElementById("appFooterMount"); + if (footerMount) { + footerMount.innerHTML = ` + + `; + } +})(); diff --git a/webui/js/premium_ui.js b/webui/js/premium_ui.js new file mode 100644 index 0000000..ca3efa0 --- /dev/null +++ b/webui/js/premium_ui.js @@ -0,0 +1,424 @@ +(function premiumUi() { + const ready = (fn) => { + if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", fn, { once: true }); + } else { + fn(); + } + }; + + ready(() => { + document.documentElement.classList.add("premium-ui"); + syncActivePanelState(); + ensureReferenceWorkspace(); + ensureDashboardRail(); + bindReplicaBindings(); + updateReplicaBindings(); + updateDashboardRail(); + addRevealStagger(); + bindSpotlights(); + bindPanelPulse(); + observeDynamicCards(); + window.setInterval(updateDashboardRail, 1800); + window.setInterval(updateReplicaBindings, 1200); + }); + + function addRevealStagger(root = document) { + const groups = [ + ".overviewCard", + ".configRail", + ".workspaceHeader", + ".panel.active", + ".card[data-panel]", + ".statsGrid .stat", + ".chartBlock", + ".premiumConfigCard", + ]; + let index = 0; + root.querySelectorAll(groups.join(",")).forEach((el) => { + if (el.dataset.premiumReveal === "1") return; + el.dataset.premiumReveal = "1"; + el.style.setProperty("--stagger", String(Math.min(index, 12))); + el.classList.add("premiumReveal"); + index += 1; + }); + } + + function bindSpotlights(root = document) { + const selector = [ + ".header", + ".overviewCard", + ".card", + ".panel", + ".workspaceHeader", + ".chartBlock", + ".stat", + ".reservationItem", + ".btn", + ".tabBtn", + ".premiumConfigCard", + ".premiumField", + ].join(","); + + root.querySelectorAll(selector).forEach((el) => { + if (el.dataset.premiumSpotlight === "1") return; + el.dataset.premiumSpotlight = "1"; + let raf = 0; + let lastEvent = null; + const update = () => { + raf = 0; + if (!lastEvent) return; + const rect = el.getBoundingClientRect(); + const x = ((lastEvent.clientX - rect.left) / Math.max(rect.width, 1)) * 100; + const y = ((lastEvent.clientY - rect.top) / Math.max(rect.height, 1)) * 100; + el.style.setProperty("--mx", `${Math.max(0, Math.min(100, x)).toFixed(2)}%`); + el.style.setProperty("--my", `${Math.max(0, Math.min(100, y)).toFixed(2)}%`); + }; + el.addEventListener("pointermove", (event) => { + if (window.matchMedia && window.matchMedia("(pointer: coarse)").matches) return; + lastEvent = event; + if (!raf) raf = requestAnimationFrame(update); + }, { passive: true }); + el.addEventListener("pointerleave", () => { + lastEvent = null; + if (raf) cancelAnimationFrame(raf); + raf = 0; + el.style.removeProperty("--mx"); + el.style.removeProperty("--my"); + }, { passive: true }); + }); + } + + function bindPanelPulse() { + document.querySelectorAll(".tabBtn[data-target]").forEach((btn) => { + if (btn.dataset.premiumTabBound === "1") return; + btn.dataset.premiumTabBound = "1"; + btn.addEventListener("click", () => { + syncActivePanelState(btn.dataset.target); + window.requestAnimationFrame(() => { + const target = btn.dataset.target; + const panel = findPanelByTarget(target); + if (!panel) return; + panel.classList.remove("isPremiumPulse"); + void panel.offsetWidth; + panel.classList.add("isPremiumPulse"); + setTimeout(() => panel.classList.remove("isPremiumPulse"), 620); + addRevealStagger(panel); + bindSpotlights(panel); + }); + }); + }); + } + + function findPanelByTarget(target) { + if (!target) return null; + try { + if (window.CSS && typeof window.CSS.escape === "function") { + return document.querySelector(`.panel[data-panel="${window.CSS.escape(target)}"]`); + } + } catch (_) {} + return Array.from(document.querySelectorAll(".panel[data-panel]")) + .find((panel) => panel.dataset.panel === target) || null; + } + + function syncActivePanelState(target) { + const activeTarget = target + || document.querySelector(".tabBtn.active[data-target]")?.dataset.target + || "device"; + document.documentElement.dataset.premiumPanel = activeTarget; + if (activeTarget === "device") { + const workspace = document.querySelector(".configWorkspace"); + if (workspace) workspace.scrollTop = 0; + } + } + + function ensureReferenceWorkspace() { + const workspace = document.querySelector(".configWorkspace"); + if (!workspace || workspace.querySelector(".premiumReplica")) return; + const replica = document.createElement("div"); + replica.className = "premiumReplica"; + replica.innerHTML = ` +
+
+
▣设备配置
+ +
+
+ + +
+
+ + + + + +
+
+ +
+
+
⌘运行参数
+ +
+
+ + + + + +
+
+ + + + + +
+
+ +
+
+
▽筛选设置
+ +
+
+ + + + + + +
+
+ +
+
+
▣高价值福袋预约
+ +
+
+ + + + + + +
+
+ +
+
+
♙养号设置
+ +
+
+ + + + + + +
+
+ + + + + + +
+
+ +
+ + + +
+ `; + const panels = workspace.querySelector(".panels"); + workspace.insertBefore(replica, panels || null); + workspace.scrollTop = 0; + } + + function bindReplicaBindings() { + document.querySelectorAll("[data-premium-click]").forEach((btn) => { + if (btn.dataset.premiumClickBound === "1") return; + btn.dataset.premiumClickBound = "1"; + btn.addEventListener("click", () => { + const target = document.querySelector(btn.dataset.premiumClick); + if (target) target.click(); + }); + }); + + document.querySelectorAll("[data-premium-bind]").forEach((mirror) => { + if (mirror.dataset.premiumBindBound === "1") return; + mirror.dataset.premiumBindBound = "1"; + const applyToTarget = () => { + const target = document.querySelector(mirror.dataset.premiumBind); + if (!target) return; + if (target.type === "checkbox") { + target.checked = Boolean(mirror.checked); + } else { + target.value = mirror.value; + } + target.dispatchEvent(new Event("input", { bubbles: true })); + target.dispatchEvent(new Event("change", { bubbles: true })); + }; + mirror.addEventListener("input", applyToTarget); + mirror.addEventListener("change", applyToTarget); + }); + } + + function updateReplicaBindings() { + document.querySelectorAll("[data-premium-bind]").forEach((mirror) => { + const target = document.querySelector(mirror.dataset.premiumBind); + if (!target || mirror === document.activeElement) return; + if (mirror.type === "checkbox" && target.type !== "checkbox") return; + if (mirror.tagName === "SELECT" && target.tagName === "SELECT") { + const source = Array.from(target.options).map((option) => ({ + value: option.value, + text: option.textContent, + })); + const current = Array.from(mirror.options).map((option) => `${option.value}\n${option.textContent}`).join("\n"); + const next = source.map((option) => `${option.value}\n${option.text}`).join("\n"); + if (current !== next) { + mirror.innerHTML = ""; + source.forEach((option) => { + const el = document.createElement("option"); + el.value = option.value; + el.textContent = option.text; + mirror.appendChild(el); + }); + } + } + if (target.type === "checkbox") { + mirror.checked = Boolean(target.checked); + } else if ("value" in target) { + mirror.value = target.value; + } + mirror.disabled = Boolean(target.disabled); + }); + } + + function ensureDashboardRail() { + const overview = document.querySelector(".overview"); + if (!overview || overview.querySelector(".premiumDashboard")) return; + const rail = document.createElement("div"); + rail.className = "premiumDashboard"; + rail.innerHTML = ` +
+
+
收益趋势
+
近7天按小时
+
+ +
+
+
+
设备状态
+ 0 +
+
+
+
+
+
最新日志
+ +
+
+
+ `; + overview.appendChild(rail); + rail.querySelectorAll("[data-premium-jump]").forEach((btn) => { + btn.addEventListener("click", () => { + const target = btn.dataset.premiumJump; + const tab = document.querySelector(`.tabBtn[data-target="${target}"]`); + if (tab) tab.click(); + }); + }); + } + + function updateDashboardRail() { + const deviceTable = document.getElementById("premiumDeviceTable"); + const latestLogs = document.getElementById("premiumLatestLogs"); + if (!deviceTable || !latestLogs) return; + + const deviceSelect = document.getElementById("device"); + const selectedDevice = deviceSelect?.selectedOptions?.[0]?.textContent?.trim() + || deviceSelect?.value + || "自动选择"; + const runState = textOf("topRunState") || "等待启动"; + const adbState = textOf("topAdbState") || textOf("adbStatus") || "ADB 状态待检测"; + const runMeta = textOf("topRunMeta") || "-"; + const deviceCount = document.getElementById("premiumDeviceCount"); + if (deviceCount) deviceCount.textContent = (textOf("topDeviceState").match(/\d+/) || ["1"])[0]; + + deviceTable.innerHTML = ""; + [ + ["当前设备", selectedDevice, runState], + ["连接状态", adbState, "在线"], + ["运行信息", runMeta, "同步"], + ].forEach((row) => { + const item = document.createElement("div"); + item.className = "premiumDeviceRow"; + item.innerHTML = `${escapeSmall(row[0])}${escapeSmall(row[1])}${escapeSmall(row[2])}`; + deviceTable.appendChild(item); + }); + + latestLogs.innerHTML = ""; + const lines = String(document.getElementById("runLog")?.textContent || "") + .split(/\r?\n/) + .map((line) => line.trim()) + .filter(Boolean) + .slice(-6) + .reverse(); + const shown = lines.length ? lines : ["等待运行日志写入"]; + shown.forEach((line) => { + const item = document.createElement("div"); + item.className = "premiumLogRow"; + item.textContent = line.length > 110 ? `${line.slice(0, 110)}...` : line; + latestLogs.appendChild(item); + }); + } + + function textOf(id) { + return String(document.getElementById(id)?.textContent || "").trim(); + } + + function escapeSmall(value) { + return String(value ?? "") + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """); + } + + function observeDynamicCards() { + if (!("MutationObserver" in window)) return; + const observer = new MutationObserver((records) => { + let shouldRefresh = false; + for (const record of records) { + if (record.addedNodes && record.addedNodes.length) { + shouldRefresh = true; + break; + } + } + if (!shouldRefresh) return; + addRevealStagger(); + bindSpotlights(); + }); + observer.observe(document.body, { childList: true, subtree: true }); + } +})(); diff --git a/webui/js/theme_bootstrap.js b/webui/js/theme_bootstrap.js new file mode 100644 index 0000000..82261d2 --- /dev/null +++ b/webui/js/theme_bootstrap.js @@ -0,0 +1,13 @@ +(function () { + try { + var saved = localStorage.getItem("ui-theme"); + var theme = + saved === "dark" || saved === "light" + ? saved + : window.matchMedia && + window.matchMedia("(prefers-color-scheme: dark)").matches + ? "dark" + : "light"; + document.documentElement.setAttribute("data-theme", theme); + } catch (e) {} +})(); diff --git a/webui/js/top_templates.js b/webui/js/top_templates.js new file mode 100644 index 0000000..79692e9 --- /dev/null +++ b/webui/js/top_templates.js @@ -0,0 +1,112 @@ +// Top-of-page HTML templates split from index.html. +(function mountTopTemplates() { + const topMount = document.getElementById("topTemplatesMount"); + if (!topMount) return; + topMount.innerHTML = ` +
+
+ +
+
抖音挂机
+
专业版 v2.6.1
+
+
+
+
+ + + +
+
+ + + + + + +
+
+
+ +
+
+
运行状态
+
+ + 等待启动 +
+
PID - / 运行时长 -
+
+
+
设备连接
+
未刷新
+
ADB 状态待检测
+
+
+
福袋处理
+
0 / 0
+
打开详情 / 成功参与
+ +
+
+
日志缓存
+
-
+
最后日志 -
+
+
+ `; +})();