feat (ui) CSS
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -28,6 +28,10 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
body = index_path.read_text(encoding="utf-8")
|
||||
self.assertIn('id="workspace"', body)
|
||||
self.assertIn('id="footer-bar"', body)
|
||||
self.assertIn('id="title-zone-actions"', body)
|
||||
self.assertIn('id="status"', body)
|
||||
self.assertIn('id="theme-toggle"', body)
|
||||
self.assertIn('id="theme-toggle-icon"', body)
|
||||
self.assertIn('id="left-pane"', body)
|
||||
self.assertIn('id="right-pane"', body)
|
||||
self.assertIn('id="left-items"', body)
|
||||
@@ -82,6 +86,9 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
self.assertTrue((static_root / "style.css").exists())
|
||||
app_js = (static_root / "app.js").read_text(encoding="utf-8")
|
||||
self.assertIn('currentPath: "/Volumes"', app_js)
|
||||
self.assertIn('const THEME_STORAGE_KEY = "webmanager-theme"', app_js)
|
||||
self.assertIn("document.documentElement.dataset.theme", app_js)
|
||||
self.assertIn('document.getElementById("theme-toggle").onclick = toggleTheme;', app_js)
|
||||
self.assertIn('Cross-root directory move is not supported in v1', app_js)
|
||||
self.assertIn('Batch directory move is not supported in v1', app_js)
|
||||
self.assertIn('Batch move requires all selected items to be in the same root', app_js)
|
||||
@@ -89,6 +96,10 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
||||
self.assertIn('sources: selectedItems.map((item) => item.path)', app_js)
|
||||
self.assertIn("function rootKeyFromPath(path)", app_js)
|
||||
self.assertIn("function isNestedPath(sourcePath, destinationPath)", app_js)
|
||||
style_css = (static_root / "style.css").read_text(encoding="utf-8")
|
||||
self.assertIn(':root[data-theme="dark"]', style_css)
|
||||
self.assertIn(':root[data-theme="light"]', style_css)
|
||||
self.assertIn('#theme-toggle', style_css)
|
||||
|
||||
app_js_url = app.url_path_for("ui", path="/app.js")
|
||||
style_css_url = app.url_path_for("ui", path="/style.css")
|
||||
|
||||
@@ -36,6 +36,39 @@ let batchMoveState = {
|
||||
destinationBase: "",
|
||||
count: 0,
|
||||
};
|
||||
const THEME_STORAGE_KEY = "webmanager-theme";
|
||||
|
||||
function preferredTheme() {
|
||||
const stored = window.localStorage.getItem(THEME_STORAGE_KEY);
|
||||
if (stored === "light" || stored === "dark") {
|
||||
return stored;
|
||||
}
|
||||
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: light)").matches) {
|
||||
return "light";
|
||||
}
|
||||
return "dark";
|
||||
}
|
||||
|
||||
function applyTheme(theme) {
|
||||
const nextTheme = theme === "light" ? "light" : "dark";
|
||||
document.documentElement.dataset.theme = nextTheme;
|
||||
const icon = document.getElementById("theme-toggle-icon");
|
||||
const button = document.getElementById("theme-toggle");
|
||||
if (icon) {
|
||||
icon.textContent = nextTheme === "dark" ? "☾" : "☀";
|
||||
}
|
||||
if (button) {
|
||||
button.setAttribute("aria-label", `Switch to ${nextTheme === "dark" ? "light" : "dark"} mode`);
|
||||
button.setAttribute("title", `Switch to ${nextTheme === "dark" ? "light" : "dark"} mode`);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleTheme() {
|
||||
const current = document.documentElement.dataset.theme === "light" ? "light" : "dark";
|
||||
const next = current === "dark" ? "light" : "dark";
|
||||
applyTheme(next);
|
||||
window.localStorage.setItem(THEME_STORAGE_KEY, next);
|
||||
}
|
||||
|
||||
function paneState(pane) {
|
||||
return state.panes[pane];
|
||||
@@ -1420,6 +1453,7 @@ function setupEvents() {
|
||||
setupPaneEvents("left");
|
||||
setupPaneEvents("right");
|
||||
document.addEventListener("keydown", handleKeyboardShortcuts);
|
||||
document.getElementById("theme-toggle").onclick = toggleTheme;
|
||||
document.getElementById("view-btn").onclick = openViewer;
|
||||
document.getElementById("edit-btn").onclick = openEditor;
|
||||
document.getElementById("rename-btn").onclick = renameSelected;
|
||||
@@ -1498,6 +1532,7 @@ function setupEvents() {
|
||||
|
||||
async function init() {
|
||||
setError("actions-error", "");
|
||||
applyTheme(preferredTheme());
|
||||
setActivePane("left");
|
||||
setupEvents();
|
||||
await Promise.all([loadBrowsePane("left"), loadBrowsePane("right")]);
|
||||
|
||||
@@ -10,7 +10,12 @@
|
||||
<div id="app-shell">
|
||||
<header id="title-zone">
|
||||
<h1>WebManager v2</h1>
|
||||
<div id="status"></div>
|
||||
<div id="title-zone-actions">
|
||||
<div id="status"></div>
|
||||
<button id="theme-toggle" type="button" aria-label="Toggle theme" title="Toggle theme">
|
||||
<span id="theme-toggle-icon" aria-hidden="true">☾</span>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main id="workspace" class="workspace">
|
||||
|
||||
+168
-84
@@ -1,14 +1,66 @@
|
||||
:root {
|
||||
--bg: #f4f7fb;
|
||||
--panel: #ffffff;
|
||||
--border: #d7deea;
|
||||
--text: #192232;
|
||||
--muted: #5c687c;
|
||||
--error: #b11d1d;
|
||||
--accent: #1b5ec9;
|
||||
--active-border: #1b5ec9;
|
||||
--active-bg: #ffffff;
|
||||
--bottom-reserve: 0px;
|
||||
--radius-sm: 4px;
|
||||
--radius-md: 8px;
|
||||
--shadow-elevated: 0 10px 28px rgba(12, 20, 32, 0.18);
|
||||
}
|
||||
|
||||
:root[data-theme="dark"] {
|
||||
--color-page-bg: #161c25;
|
||||
--color-surface: #1d2531;
|
||||
--color-surface-elevated: #222c39;
|
||||
--color-border: #324052;
|
||||
--color-border-strong: #55739f;
|
||||
--color-text-primary: #e7edf6;
|
||||
--color-text-muted: #9aa9bd;
|
||||
--color-accent: #6aa5ff;
|
||||
--color-accent-contrast: #07192f;
|
||||
--color-selection-bg: #233754;
|
||||
--color-selection-border: #5c8fda;
|
||||
--color-current-row-bg: #1f2d42;
|
||||
--color-current-row-border: #6a87b5;
|
||||
--color-active-pane-border: #78adff;
|
||||
--color-button-bg: #283444;
|
||||
--color-button-hover: #314258;
|
||||
--color-button-secondary-bg: #202935;
|
||||
--color-danger: #ff8e8e;
|
||||
--color-danger-bg: #462328;
|
||||
--color-overlay-bg: rgba(8, 12, 18, 0.62);
|
||||
}
|
||||
|
||||
:root[data-theme="light"] {
|
||||
--color-page-bg: #eef3f9;
|
||||
--color-surface: #ffffff;
|
||||
--color-surface-elevated: #f8fbff;
|
||||
--color-border: #d6e0ec;
|
||||
--color-border-strong: #7ca0d1;
|
||||
--color-text-primary: #172233;
|
||||
--color-text-muted: #617086;
|
||||
--color-accent: #235ec7;
|
||||
--color-accent-contrast: #ffffff;
|
||||
--color-selection-bg: #e5eefc;
|
||||
--color-selection-border: #7b9fdb;
|
||||
--color-current-row-bg: #f1f6ff;
|
||||
--color-current-row-border: #a2bce8;
|
||||
--color-active-pane-border: #235ec7;
|
||||
--color-button-bg: #f6f9fd;
|
||||
--color-button-hover: #edf3fb;
|
||||
--color-button-secondary-bg: #f3f6fb;
|
||||
--color-danger: #b42323;
|
||||
--color-danger-bg: #fdecec;
|
||||
--color-overlay-bg: rgba(18, 28, 40, 0.30);
|
||||
}
|
||||
|
||||
:root {
|
||||
--bg: var(--color-page-bg);
|
||||
--panel: var(--color-surface);
|
||||
--border: var(--color-border);
|
||||
--text: var(--color-text-primary);
|
||||
--muted: var(--color-text-muted);
|
||||
--error: var(--color-danger);
|
||||
--accent: var(--color-accent);
|
||||
--active-border: var(--color-active-pane-border);
|
||||
--active-bg: var(--color-surface);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
@@ -20,8 +72,8 @@ html, body {
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: "Segoe UI", Tahoma, sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
background: var(--color-page-bg);
|
||||
color: var(--color-text-primary);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -32,14 +84,21 @@ body {
|
||||
}
|
||||
|
||||
#title-zone {
|
||||
padding: 6px 10px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: var(--panel);
|
||||
padding: 7px 10px;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
background: var(--color-surface-elevated);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
#title-zone-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
margin: 0;
|
||||
}
|
||||
@@ -58,9 +117,9 @@ h1 {
|
||||
}
|
||||
|
||||
.panel {
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
@@ -72,9 +131,9 @@ h1 {
|
||||
}
|
||||
|
||||
.pane.active-pane {
|
||||
border-color: var(--active-border);
|
||||
box-shadow: 0 0 0 1px var(--active-border) inset;
|
||||
background: var(--panel);
|
||||
border-color: var(--color-active-pane-border);
|
||||
box-shadow: 0 0 0 1px var(--color-active-pane-border) inset;
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.pane-header {
|
||||
@@ -86,7 +145,7 @@ h1 {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
border-top: 1px solid var(--border);
|
||||
border-top: 1px solid var(--color-border);
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
@@ -114,24 +173,36 @@ h1 {
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
color: var(--muted);
|
||||
color: var(--color-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
input, button {
|
||||
input, button, textarea {
|
||||
font: inherit;
|
||||
padding: 4px 6px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
padding: 5px 7px;
|
||||
color: var(--color-text-primary);
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
button {
|
||||
border: 1px solid var(--border);
|
||||
background: #f8fafc;
|
||||
padding: 4px 7px;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--color-button-bg);
|
||||
color: var(--color-text-primary);
|
||||
cursor: pointer;
|
||||
transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
border-color: var(--accent);
|
||||
background: var(--color-button-hover);
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
@@ -139,8 +210,25 @@ button:disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
#theme-toggle {
|
||||
width: 28px;
|
||||
min-width: 28px;
|
||||
height: 28px;
|
||||
padding: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 999px;
|
||||
background: var(--color-button-secondary-bg);
|
||||
}
|
||||
|
||||
#theme-toggle-icon {
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.pathline {
|
||||
color: var(--muted);
|
||||
color: var(--color-text-muted);
|
||||
margin-bottom: 3px;
|
||||
font-size: 12px;
|
||||
}
|
||||
@@ -156,22 +244,20 @@ button:disabled {
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
margin-bottom: 3px;
|
||||
color: var(--muted);
|
||||
color: var(--color-text-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.breadcrumbs button {
|
||||
padding: 1px 4px;
|
||||
font-size: 12px;
|
||||
background: transparent;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.list-label {
|
||||
font-size: 11px;
|
||||
margin: 0;
|
||||
padding: 2px 0;
|
||||
color: var(--muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
.breadcrumbs button:hover {
|
||||
color: var(--color-accent);
|
||||
background: var(--color-button-secondary-bg);
|
||||
}
|
||||
|
||||
.list {
|
||||
@@ -185,9 +271,9 @@ button:disabled {
|
||||
grid-template-columns: 14px minmax(0, 1fr) 88px 138px;
|
||||
gap: 6px;
|
||||
padding: 2px 0 4px 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
margin-bottom: 2px;
|
||||
color: var(--muted);
|
||||
color: var(--color-text-muted);
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
@@ -199,7 +285,7 @@ button:disabled {
|
||||
}
|
||||
|
||||
.list li {
|
||||
border-top: 1px solid var(--border);
|
||||
border-top: 1px solid var(--color-border);
|
||||
padding: 5px 0 4px 0;
|
||||
display: grid;
|
||||
grid-template-columns: 14px minmax(0, 1fr) 88px 138px;
|
||||
@@ -212,19 +298,20 @@ button:disabled {
|
||||
}
|
||||
|
||||
.list li.is-selected {
|
||||
background: #e9f0fd;
|
||||
background: var(--color-selection-bg);
|
||||
}
|
||||
|
||||
.list li.is-current-row {
|
||||
box-shadow: inset 0 0 0 1px #9cb7e8;
|
||||
box-shadow: inset 0 0 0 1px var(--color-current-row-border);
|
||||
}
|
||||
|
||||
.list li.is-current-row:not(.is-selected) {
|
||||
background: #f4f8ff;
|
||||
background: var(--color-current-row-bg);
|
||||
}
|
||||
|
||||
.list li.is-current-row.is-selected {
|
||||
background: #e3edff;
|
||||
background: var(--color-selection-bg);
|
||||
box-shadow: inset 0 0 0 1px var(--color-current-row-border);
|
||||
}
|
||||
|
||||
.select-marker {
|
||||
@@ -232,21 +319,18 @@ button:disabled {
|
||||
width: 10px;
|
||||
min-width: 10px;
|
||||
height: 10px;
|
||||
border: 1px solid var(--border);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 2px;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.list li.is-selected .select-marker {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.list li.is-selected .select-marker,
|
||||
.select-marker:checked {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
background: var(--color-accent);
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
.entry-name {
|
||||
@@ -264,7 +348,7 @@ button:disabled {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
color: var(--accent);
|
||||
color: var(--color-accent);
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
@@ -272,29 +356,35 @@ button:disabled {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.dir-link:hover {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.entry-size,
|
||||
.entry-modified {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
color: var(--color-text-muted);
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: var(--error);
|
||||
color: var(--color-danger);
|
||||
min-height: 12px;
|
||||
margin-bottom: 2px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#status {
|
||||
color: var(--muted);
|
||||
color: var(--color-text-muted);
|
||||
font-size: 12px;
|
||||
min-width: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#footer-bar {
|
||||
border-top: 1px solid var(--border);
|
||||
background: var(--panel);
|
||||
border-top: 1px solid var(--color-border);
|
||||
background: var(--color-surface-elevated);
|
||||
padding: 4px 10px 3px 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -325,7 +415,7 @@ button:disabled {
|
||||
}
|
||||
|
||||
.shortcut-hint {
|
||||
color: var(--muted);
|
||||
color: var(--color-text-muted);
|
||||
font-size: 10px;
|
||||
line-height: 1;
|
||||
letter-spacing: 0.02em;
|
||||
@@ -335,7 +425,7 @@ button:disabled {
|
||||
.popup-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(20, 32, 50, 0.25);
|
||||
background: var(--color-overlay-bg);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -348,30 +438,25 @@ button:disabled {
|
||||
|
||||
.popup-card {
|
||||
width: min(420px, calc(100vw - 24px));
|
||||
background: #fff;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
background: var(--color-surface-elevated);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 10px;
|
||||
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
|
||||
box-shadow: var(--shadow-elevated);
|
||||
}
|
||||
|
||||
.popup-meta {
|
||||
color: var(--muted);
|
||||
color: var(--color-text-muted);
|
||||
font-size: 12px;
|
||||
margin: 4px 0 8px 0;
|
||||
}
|
||||
|
||||
.popup-label {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
#wildcard-pattern-input {
|
||||
width: 100%;
|
||||
margin-top: 4px;
|
||||
margin-bottom: 6px;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
#wildcard-pattern-input,
|
||||
#rename-move-input {
|
||||
width: 100%;
|
||||
margin-top: 4px;
|
||||
@@ -400,33 +485,32 @@ button:disabled {
|
||||
padding: 2px 8px;
|
||||
}
|
||||
|
||||
.viewer-content {
|
||||
.viewer-content,
|
||||
.editor-content {
|
||||
margin: 6px 0 0 0;
|
||||
padding: 10px;
|
||||
overflow: auto;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--color-surface);
|
||||
color: var(--color-text-primary);
|
||||
font: 12px/1.45 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
|
||||
}
|
||||
|
||||
.viewer-content {
|
||||
min-height: 240px;
|
||||
max-height: calc(100vh - 180px);
|
||||
overflow: auto;
|
||||
border: 1px solid var(--border);
|
||||
background: #f8fafc;
|
||||
color: var(--text);
|
||||
font: 12px/1.45 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.editor-content {
|
||||
margin: 6px 0 8px 0;
|
||||
padding: 10px;
|
||||
margin-bottom: 8px;
|
||||
min-height: 280px;
|
||||
max-height: calc(100vh - 220px);
|
||||
width: 100%;
|
||||
resize: vertical;
|
||||
overflow: auto;
|
||||
border: 1px solid var(--border);
|
||||
background: #f8fafc;
|
||||
color: var(--text);
|
||||
font: 12px/1.45 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user