ui: simplify helper copy and center page loading feedback

This commit is contained in:
AttilaNet
2026-11-11 21:08:48 +08:00
parent d1e7f3c717
commit e23e7586c4
25 changed files with 747 additions and 141 deletions
+45 -31
View File
@@ -27,10 +27,10 @@ function strategyRequested(summary) { return typeof summary?.strategy_requested=
function strategyDetails(account) {
if(!account)return '';
const summary=account.summary,requested=strategyRequested(summary);
if(!requested)return summary.strategy_requested===false?'策略已停止(用户暂停);暂停会保留到再次“开启”,账号仍会按设定时长自动重登。':'策略已停止,可在顶部“开启”继续执行已勾选功能。';
if(summary.strategy_state==='blocked')return `策略等待处理:${summary.strategy_message || '请检查执行结果,确认后再继续。'}`;
if(summary.running && gameAvailable(account))return '角色状态自动刷新,正在自动执行已配置且已勾选的功能;可在顶部“停止”。';
const parts=['已请求自动执行已勾选功能,等待恢复;可在顶部“停止”暂停执行。'];
if(!requested)return summary.strategy_requested===false?'策略已停止(用户暂停)':'策略已停止';
if(summary.strategy_state==='blocked')return `策略等待处理:${summary.strategy_message || '等待确认执行结果'}`;
if(summary.running && gameAvailable(account))return '策略运行中';
const parts=['等待自动恢复'];
if(summary.strategy_message)parts.push(summary.strategy_message);
const value=summary.strategy_retry_at;
const retryAt=typeof value==='number'?(value<1e12?value*1000:value):Date.parse(value);
@@ -96,8 +96,8 @@ function renderPageConnection(page) {
}
const stale=!gameAvailable(page.account),message=connectionDetails(page.account);
page.connectionStatus.hidden=!stale;page.connectionStatus.textContent=message;
if(stale){page.loading.dataset.loading='false';page.loading.textContent=page.data?'已载入缓存':'缓存中暂无数据';clearTimeout(page.loadTimer);}
else if(page.loading.textContent.includes('缓存')){page.loading.textContent=page.data?'已载入':'正在读取…';page.loading.dataset.loading=String(!page.data);}
if(stale || page.root.hidden){clearTimeout(page.loadTimer);page.pending=false;}
page.setLoading(!stale && page.errorBox.hidden && (page.fetching || page.pending));
$$('button[data-operation]',page.actionsHost).filter(button=>gameRefreshOperations.has(button.dataset.operation)).forEach(button=>button.disabled=stale);
}
@@ -292,7 +292,7 @@ async function perform(account,operation,payload={},options={}) {
const page=options.page || account.pages.get(account.page);if(page)await loadPage(page,true);
if(operation==='login'&&result)account.pages.get('login')?.login?.update(result);
if(operation==='forget_login')account.lastFailure='';
const message=loginOperations.has(operation)?account.summary.running && strategyRequested(account.summary)?'已读取角色,已自动开启策略,执行已配置且已勾选的功能;可在顶部“停止”。':`已读取角色。${strategyDetails(account)}`:result?.message;
const message=loginOperations.has(operation)?account.summary.running && strategyRequested(account.summary)?'已读取角色,策略运行中':`已读取角色。${strategyDetails(account)}`:result?.message;
if(message && operation!=='refresh')notice(message);
setStatus(operation==='refresh'?'状态已刷新':message || `${operationLabels[operation] || '操作'}已完成`);
return result;
@@ -310,15 +310,17 @@ function getPage(account,key) {
async function loadPage(page,force=false) {
if(!force && !gameAvailable(page.account) && (page.key!=='login'||state.webStatusError||page.account.transportErrors.has('status'))){clearTimeout(page.loadTimer);renderPageConnection(page);return;}
if(page.fetching){if(force)page.reload=true;return;}
page.fetching=true;const generation=page.generation || 0;
clearTimeout(page.loadTimer);
page.fetching=true;page.clearError();renderPageConnection(page);
const generation=page.generation || 0;
try {
const response=await api.view(page.account.id,page.key,page.query);
if(generation!==(page.generation||0))return;
page.clearError();page.render(response.data,response.loading);page.lastLoad=Date.now();
if(generation!==(page.generation||0)){page.pending=false;return;}
page.pending=Boolean(response.loading);page.render(response.data);page.lastLoad=Date.now();
transportError(page.account,`view:${page.key}`,'页面数据',null);renderPageConnection(page);
if(response.loading && gameAvailable(page.account)){clearTimeout(page.loadTimer);page.loadTimer=setTimeout(()=>loadPage(page),650);}
}catch(failure){if(generation===(page.generation||0)){page.showError(failure.message);transportError(page.account,`view:${page.key}`,'页面数据',failure);}}
finally{page.fetching=false;if(page.reload){page.reload=false;loadPage(page);}}
if(page.pending && gameAvailable(page.account) && !page.root.hidden && page.root.isConnected)page.loadTimer=setTimeout(()=>loadPage(page),650);
}catch(failure){if(generation===(page.generation||0)){page.pending=false;clearTimeout(page.loadTimer);page.showError(failure.message);transportError(page.account,`view:${page.key}`,'页面数据',failure);}}
finally{page.fetching=false;renderPageConnection(page);if(page.reload){page.reload=false;loadPage(page);}}
}
function selectPage(key) {
@@ -326,7 +328,10 @@ function selectPage(key) {
saveLogScroll(account);
if(account.page!==key)account.pages.get(account.page)?.login?.clearPassword();
account.page=key;
state.accounts.forEach(other=>other.pages.forEach(page=>{page.root.hidden=other.id!==account.id||page.key!==key;}));
state.accounts.forEach(other=>other.pages.forEach(page=>{
page.root.hidden=other.id!==account.id||page.key!==key;
if(page.root.hidden){clearTimeout(page.loadTimer);page.pending=false;page.setLoading(false);}
}));
const page=getPage(account,key);page.root.hidden=false;
renderLogs();
$$('.page-tab').forEach(tab=>{const selected=tab.dataset.page===key;tab.setAttribute('aria-selected',String(selected));tab.tabIndex=selected?0:-1;});
@@ -339,6 +344,7 @@ async function selectAccount(id) {
if(previous?.edits.size)flushConfig(previous).catch(error);
state.active=id;const account=current();if(!account)return;
$('#page-host').querySelector('.initial-state')?.remove();
$('#page-host').querySelector(':scope > .loading-state')?.remove();
renderAccountTabs();renderSummary();renderLogs(true);applyLogLayout(account);selectPage(account.page);
if(!account.config)try{await refreshConfig(account);}catch(failure){error(failure);}
fetchLogs(account);
@@ -346,7 +352,7 @@ async function selectAccount(id) {
async function addAccount(demo=false) {
const label=el('input',{type:'text','aria-label':'账号页签名称',placeholder:demo?'离线演示':'账号名称(可留空)',maxlength:80});
const result=await dialog(demo?'新增离线演示账号':'新增账号',el('div',{},el('label',{class:'field'},el('span',{class:'field-label',text:'账号名称'}),label),el('p',{class:'info-note',text:demo?'使用服务端离线演示状态,不连接游戏服务器。':'创建独立账号工作区,然后在登录页连接游戏角色。'})),{confirm:'新增',read:()=>({label:label.value.trim()})});
const result=await dialog(demo?'新增离线演示账号':'新增账号',el('label',{class:'field'},el('span',{class:'field-label',text:'账号名称'}),label),{confirm:'新增',read:()=>({label:label.value.trim()})});
if(!result)return;
const summary=await api.create(result.label,demo);state.accounts.set(summary.id,makeAccount(summary));await selectAccount(summary.id);notice(demo?'离线演示账号已创建':'账号已创建,请在登录页登录。');
}
@@ -409,7 +415,7 @@ async function exportYields(account=current()) {
async function command(name,account=current()) {
try {
if(name==='add-account'||name==='add-demo')return await addAccount(name==='add-demo');
if(name==='about')return dialog('关于牧场助手',el('div',{},el('p',{text:`牧羊人之心牧场助手 Web ${state.meta?.version || '2.0.4'}`}),el('p',{text:`游戏数据版本 ${state.meta?.gameVersion || '1.9.68'}`}),el('p',{class:'info-note',text:'与桌面助手共用核心策略。配置在服务端自动保存;在线时默认自动执行已勾选功能,连接恢复后继续执行。顶部“停止”仅暂停执行,暂停在重新登录和服务重启后仍保留,直到再次“开启”。已保存的账号按设定时长自动重登,退出登录不取消;只有清除登录记录或删除账号才取消。'})),{info:true});
if(name==='about')return dialog('关于牧场助手',el('div',{},el('p',{text:`牧羊人之心牧场助手 Web ${state.meta?.version || '2.0.5'}`}),el('p',{text:`游戏数据版本 ${state.meta?.gameVersion || '1.9.68'}`})),{info:true});
if(name==='updates')return await showUpdates();
if(name==='admin-logout'){hideWorkbench();try{await api.logout();}finally{requireAuth();}return;}
if(!account)throw new Error('请先新增或选择账号。');
@@ -429,7 +435,7 @@ async function command(name,account=current()) {
}
if(name==='remove-account'){
if(!await confirm('移除当前账号',`移除“${account.summary.label || '当前账号'}”及其保存的会话和策略?此操作无法撤销。`,{confirm:'移除账号',danger:true}))return;
await api.remove(account.id);account.jobs.forEach(record=>record.reject(new Error('账号已移除')));account.pages.forEach(page=>{clearTimeout(page.loadTimer);page.root.remove();});clearTimeout(account.saveTimer);state.accounts.delete(account.id);state.active=null;
await api.remove(account.id);account.jobs.forEach(record=>record.reject(new Error('账号已移除')));account.pages.forEach(page=>{clearTimeout(page.loadTimer);page.setLoading(false);page.root.remove();});clearTimeout(account.saveTimer);state.accounts.delete(account.id);state.active=null;
if(state.accounts.size)await selectAccount(state.accounts.keys().next().value);else showNoAccounts();renderAccountTabs();renderSummary();return;
}
if(name==='export-config'){
@@ -449,10 +455,16 @@ async function command(name,account=current()) {
async function showUpdates() {
const content=el('div',{class:'detail-sections'}),values=el('div'),message=el('p'),check=el('button',{type:'button',text:'检查 GitHub 正式版本'}),apply=el('button',{type:'button',text:'提交更新请求…',disabled:true});
const loading=el('div',{class:'loading-state',role:'status','aria-label':'正在读取版本与更新状态',hidden:true},el('span',{class:'loading-spinner','aria-hidden':'true'}));
const region=el('div',{class:'loading-region','aria-busy':'false'},values,loading);
const labels={unchecked:'尚未检查',no_release:'尚无正式版本',up_to_date:'已是最新版本',available:'发现新版本',check_failed:'版本检查失败',unavailable:'更新器未就绪',pending:'等待宿主机处理',applying:'正在更新并检查健康',succeeded:'更新完成,健康检查通过',rolled_back:'更新失败,已回滚',failed:'更新失败'};
const lifetime=new AbortController();
let status,timer,closed=false,busy=false;
let status,timer,loadingTimer,closed=false,busy=false;
const active=()=>!closed && content.isConnected && $('#action-dialog').open;
const setLoading=value=>{
clearTimeout(loadingTimer);loading.hidden=true;region.setAttribute('aria-busy',String(value));
if(value)loadingTimer=setTimeout(()=>{if(active())loading.hidden=false;},150);
};
const bounded=async callback=>{
const controller=new AbortController(),abort=()=>controller.abort();
lifetime.signal.addEventListener('abort',abort,{once:true});
@@ -478,31 +490,31 @@ async function showUpdates() {
async function poll(){
if(!active())return;
if(busy){schedule();return;}
busy=true;
busy=true;setLoading(true);
try{render(await bounded(signal=>api.updates({signal})));}
catch(failure){await disconnected(failure);}
finally{busy=false;schedule();}
finally{busy=false;setLoading(false);schedule();}
}
check.addEventListener('click',async()=>{
if(busy)return;busy=true;clearTimeout(timer);check.disabled=true;check.textContent='正在检查…';
if(busy)return;busy=true;setLoading(true);clearTimeout(timer);check.disabled=true;
try{render(await bounded(signal=>api.checkUpdates({signal})));}
catch(failure){if(active())message.textContent=failure.name==='AbortError'?'版本检查暂未返回,稍后将自动读取最新状态。':failure.message;}
finally{busy=false;check.disabled=false;check.textContent='检查 GitHub 正式版本';schedule();}
finally{busy=false;setLoading(false);check.disabled=false;schedule();}
});
apply.addEventListener('click',async()=>{
if(busy || !status?.can_apply)return;
const version=status.latest_version;
if(!window.confirm(`提交 ${version} 更新请求?执行器将处理请求并可能重启服务。`))return;
busy=true;clearTimeout(timer);apply.disabled=true;
busy=true;setLoading(true);clearTimeout(timer);apply.disabled=true;
try{render(await bounded(signal=>api.applyUpdate(version,{signal})));}
catch(failure){await disconnected(failure);}
finally{busy=false;schedule();}
finally{busy=false;setLoading(false);schedule();}
});
content.append(values,message,el('div',{class:'page-toolbar'},check,apply),el('p',{class:'info-note',text:'仅检查 GitHub 正式版本。窗口打开时每 3 秒读取宿主机状态;提交请求后由受控更新器处理,服务恢复且健康检查通过后才显示完成。'}));
content.append(region,message,el('div',{class:'page-toolbar'},check,apply));
const open=dialog('版本与更新',content,{info:true});
poll();
try{await open;}
finally{closed=true;clearTimeout(timer);lifetime.abort();}
finally{closed=true;clearTimeout(timer);setLoading(false);lifetime.abort();}
}
function setLogVisible(visible) {
@@ -563,18 +575,20 @@ async function fetchLogs(account) {
}
async function showDebugEntry(account,entry) {
const pre=el('pre',{class:'debug-json',text:'正在读取所选条目的脱敏详情…'});const open=dialog('请求 / 响应详情(已脱敏)',pre,{info:true});
const pre=el('pre',{class:'debug-json',hidden:true}),loading=el('div',{class:'loading-state',role:'status','aria-label':'正在读取所选条目的脱敏详情'},el('span',{class:'loading-spinner','aria-hidden':'true'}));
const content=el('div',{'aria-busy':'true'},loading,pre),open=dialog('请求 / 响应详情(已脱敏)',content,{info:true});
try{
let path;
try{path=apiPath(entry.detail_url || entry.debug_url);}catch{/* Use the account's own endpoint for untrusted URLs. */}
const detail=await (path?request(path):api.debugEntry(account.id,entry.id));
pre.textContent=JSON.stringify(detail.details ?? detail,null,2);
}catch(failure){pre.textContent=failure.message;}
finally{loading.hidden=true;pre.hidden=false;content.setAttribute('aria-busy','false');}
await open;
}
function showNoAccounts() {
state.active=null;$('#page-host').replaceChildren(el('div',{class:'initial-state'},el('p',{text:'尚未添加账号。新增账号后登录游戏,或使用离线演示查看工作台。'}),el('div',{class:'page-toolbar'},el('button',{text:'新增账号…',onClick:()=>command('add-account')}),el('button',{text:'新增离线演示账号',onClick:()=>command('add-demo')}))));
state.active=null;$('#page-host').replaceChildren(el('div',{class:'initial-state'},el('p',{text:'尚未添加账号。'}),el('div',{class:'page-toolbar'},el('button',{text:'新增账号…',onClick:()=>command('add-account')}),el('button',{text:'新增离线演示账号',onClick:()=>command('add-demo')}))));
renderAccountTabs();renderSummary();applyLogLayout();setStatus('等待新增账号');
}
@@ -584,7 +598,7 @@ async function syncAccounts() {
catch(failure){if(failure.status!==401){state.webStatusError=`Web 状态读取失败:${failure.message || String(failure)} 正在重试。`;renderAccountTabs();renderSummary();}throw failure;}
const summaries=Array.isArray(response)?response:response.accounts || [];
const ids=new Set(summaries.map(summary=>summary.id));
for(const [id,account]of state.accounts)if(!ids.has(id)){account.pages.forEach(page=>{clearTimeout(page.loadTimer);page.root.remove();});state.accounts.delete(id);}
for(const [id,account]of state.accounts)if(!ids.has(id)){account.pages.forEach(page=>{clearTimeout(page.loadTimer);page.setLoading(false);page.root.remove();});state.accounts.delete(id);}
summaries.forEach(summary=>{
const account=state.accounts.get(summary.id);if(account){acceptSummary(account,summary);account.transportErrors.delete('status');if(account.config&&account.revision!==summary.revision&&!account.edits.size&&!account.savePromise)refreshConfig(account).catch(error);}
else state.accounts.set(summary.id,makeAccount(summary));
@@ -612,7 +626,7 @@ function hideWorkbench() {
$$('dialog[open]').forEach(root=>root.close());
$$('.context-menu').forEach(root=>root.remove());
$$('input[type="password"]').forEach(input=>input.value='');
state.accounts.forEach(account=>{clearTimeout(account.saveTimer);account.pages.forEach(page=>clearTimeout(page.loadTimer));});
state.accounts.forEach(account=>{clearTimeout(account.saveTimer);account.pages.forEach(page=>{clearTimeout(page.loadTimer);page.pending=false;page.setLoading(false);});});
}
function requireAuth() {
@@ -626,7 +640,7 @@ async function bootstrap() {
$('#app').hidden=false;
const [meta,schema]=await Promise.all([api.meta(),api.schema()]);state.meta=meta;state.schema=schema;
if(state.redirecting)return;
$('#app-version').textContent=meta.version || '2.0.4';$('#game-version').textContent=meta.gameVersion || '1.9.68';$('#access-mode').textContent=auth.access_mode==='local'||auth.access_mode==='loopback'?'本机工作台':auth.required?'管理工作台':'本机工作台';
$('#app-version').textContent=meta.version || '2.0.5';$('#game-version').textContent=meta.gameVersion || '1.9.68';$('#access-mode').textContent=auth.access_mode==='local'||auth.access_mode==='loopback'?'本机工作台':auth.required?'管理工作台':'本机工作台';
await syncAccounts();if(state.redirecting)return;state.ready=true;setStatus('工作台已连接');
}catch(failure){if(failure.status===401||$('#app').hidden){requireAuth();return;}if(state.redirecting)return;setStatus(failure.message);$('#page-host').replaceChildren(el('div',{class:'initial-state'},el('p',{text:failure.message}),el('button',{text:'重新连接',onClick:bootstrap})));}
}
+1 -3
View File
@@ -122,7 +122,6 @@ export function control(field, {get, set, onError = () => {}}) {
};
}
root.dataset.configPath = pathKey(path);
root.title = field.help || field.description || label;
root.disabled = Boolean(field.disabled || field.readonly);
sync();
return {root, sync, field};
@@ -156,7 +155,7 @@ export class PolicyForm {
entry.root.classList.add('field-input');
const boolean = ['boolean', 'bool', 'checkbox'].includes(field.type);
const wide = ['id_counts', 'counts', 'reserves', 'multiselect'].includes(field.type);
const row = el('label', {class: `field${boolean ? ' checkbox-field' : ''}${wide ? ' field-wide' : ''}`, title: field.help || field.description || ''});
const row = el('label', {class: `field${boolean ? ' checkbox-field' : ''}${wide ? ' field-wide' : ''}`});
if (entry.root.tagName === 'DIV') {
const fieldRow = el('div', {class: `field${wide ? ' field-wide' : ''}`}, el('span', {class: 'field-label', text: field.label}), entry.root);
groups.get(group).append(fieldRow);
@@ -166,7 +165,6 @@ export class PolicyForm {
groups.get(group).append(row);
entry.row = row;
}
if (field.help || field.description) groups.get(group).append(el('span', {class: 'field-help', text: field.help || field.description}));
this.controls.push(entry);
});
this.signature = signature;
+3 -3
View File
@@ -26,8 +26,8 @@
</div></details>
<details class="menu"><summary accesskey="h">帮助<span class="access-key">(H)</span></summary><div class="menu-popup"><button data-command="updates">检查版本更新…</button><button data-command="debug">调试日志</button><button data-command="about">关于…</button></div></details>
</nav>
<span class="window-title">牧羊人之心牧场助手 <span id="app-version">2.0.4</span></span>
<span id="access-mode" class="muted">正在连接本地服务</span>
<span class="window-title">牧羊人之心牧场助手 <span id="app-version">2.0.5</span></span>
<span id="access-mode" class="muted"></span>
</header>
<div class="account-bar"><div id="account-tabs" class="account-tabs" role="tablist" aria-label="账号"></div><button id="add-account" class="compact" title="新增账号">+ 新增账号</button></div>
<div class="toolbar" aria-label="角色状态和运行控制">
@@ -37,7 +37,7 @@
<div class="summary-line"><span id="data-summary">等待连接服务</span><span id="save-status" role="status">配置未载入</span></div>
<main id="workspace" class="workspace">
<nav id="page-tabs" class="page-tabs" role="tablist" aria-label="功能页面"></nav>
<div id="page-host" class="page-host"><div class="initial-state" role="status">正在载入工作台…</div></div>
<div id="page-host" class="page-host"><div class="loading-state" role="status" aria-label="加载中"><span class="loading-spinner" aria-hidden="true"></span></div></div>
</main>
<div id="log-resizer" class="log-resizer" role="separator" tabindex="0" aria-label="调整日志高度" aria-orientation="horizontal" aria-valuemin="64" aria-valuemax="480" aria-valuenow="150" title="上下拖动调整日志高度;也可使用方向键" hidden></div>
<section id="log-panel" class="log-panel" aria-label="登录日志" hidden><div class="log-toolbar"><strong id="log-heading">登录日志</strong><label><input id="debug-log" type="checkbox">调试 / 脱敏</label><label><input id="log-follow" type="checkbox" checked>自动滚动</label><label>搜索 <input id="log-search" type="search" aria-label="登录日志搜索" placeholder="筛选日志文字"></label><span id="log-count" class="muted" aria-live="off"></span><span class="spacer"></span><button id="download-log" class="small">下载日志</button><button id="clear-log" class="small" title="只清空本账号本页日志显示,保留其他页面及服务端历史">清空显示</button></div><div id="log-lines" class="log-lines" tabindex="0" role="log" aria-live="off" aria-label="登录日志内容"></div></section>
+4 -2
View File
@@ -12,7 +12,6 @@ body { margin: 0; min-height: 100dvh; display: grid; place-items: center; paddin
.admin-login { width: 100%; max-width: 370px; padding: 24px; background: #fff; border: 1px solid #cbd1d8; border-radius: 5px; }
h1 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
p { margin: 0; line-height: 1.65; overflow-wrap: anywhere; }
#auth-description { color: #55616e; margin-bottom: 20px; }
form { display: flex; flex-direction: column; gap: 8px; }
input, button { font: inherit; min-width: 0; min-height: 36px; padding: 7px 10px; border: 1px solid #afb8c2; border-radius: 3px; }
input { width: 100%; background: #fff; color: inherit; caret-color: #245d9b; }
@@ -20,7 +19,10 @@ button { margin-top: 8px; background: #245d9b; color: #fff; border-color: #245d9
button:hover { background: #1c4d83; }
button:disabled { cursor: default; opacity: .58; }
input:focus-visible, button:focus-visible { outline: 2px solid #245d9b; outline-offset: 2px; }
#auth-status { color: #55616e; }
.loading-state { display: grid; place-items: center; min-height: 64px; }
.loading-spinner { display: block; width: 32px; height: 32px; border: 3px solid #cbd1d8; border-top-color: #245d9b; border-radius: 50%; animation: loading-spin .8s linear infinite; box-shadow: 0 0 0 4px #ffffffb3; }
@keyframes loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading-spinner { animation: none; } }
#auth-error { color: #99251e; white-space: pre-wrap; }
noscript { display: block; margin-top: 16px; line-height: 1.65; }
::selection { background: #c5dbf5; color: #142b46; }
+2 -3
View File
@@ -13,11 +13,10 @@
<body>
<main class="admin-login" aria-labelledby="auth-title">
<h1 id="auth-title">登录管理工作台</h1>
<p id="auth-description">请输入此 Web 工作台的管理密码。</p>
<form id="auth-form" method="post" action="/api/auth/login" aria-describedby="auth-description">
<form id="auth-form" method="post" action="/api/auth/login">
<label for="admin-password">管理密码</label>
<input id="admin-password" name="password" type="password" autocomplete="current-password" required aria-describedby="auth-error" disabled>
<p id="auth-status" role="status">正在检查登录状态…</p>
<div id="auth-status" class="loading-state" role="status" aria-label="加载中"><span class="loading-spinner" aria-hidden="true"></span></div>
<p id="auth-error" role="alert" hidden></p>
<button type="submit" disabled>登录</button>
</form>
+5 -6
View File
@@ -10,13 +10,12 @@ const error = document.querySelector('#auth-error');
let busy = false;
let leaving = false;
function setBusy(value, message = '') {
function setBusy(value) {
busy = value;
input.disabled = value;
button.disabled = value;
form.setAttribute('aria-busy', String(value));
status.textContent = message;
status.hidden = !message;
status.hidden = !value;
}
function showError(message) {
@@ -27,7 +26,7 @@ function showError(message) {
function openWorkbench() {
leaving = true;
input.value = '';
setBusy(true, '正在进入工作台…');
setBusy(true);
location.replace(webPath('/'));
}
@@ -57,7 +56,7 @@ async function authRequest(path, body) {
}
async function checkAuth() {
setBusy(true, '正在检查登录状态…');
setBusy(true);
error.hidden = true;
try {
const auth = await authRequest('/api/auth/status');
@@ -78,7 +77,7 @@ form.addEventListener('submit', async event => {
const body = JSON.stringify({password: input.value});
input.value = '';
error.hidden = true;
setBusy(true, '正在登录…');
setBusy(true);
try {
const auth = await authRequest('/api/auth/login', body);
if (!auth.required || auth.authenticated) openWorkbench();
+45 -27
View File
@@ -18,7 +18,7 @@ class LoginPage {
this.autoReloginMessage = el('p', {role: 'status'});
this.autoReloginCountdown = el('p', {'data-auto-relogin-countdown': '', role: 'timer', 'aria-live': 'off', hidden: true});
this.autoReloginCredentials = el('p', {'data-auto-relogin-credentials': '', role: 'status', hidden: true,
text: '缺少服务端记住的账号和密码。请勾选“记住账号和密码”并完成登录,才能自动重登原区服角色。'});
text: '未保存账号或密码,自动重登不可用。'});
this.autoReloginStatus = el('div', {class: 'page-summary', 'data-auto-relogin-status': ''}, this.autoReloginMessage, this.autoReloginCountdown, this.autoReloginCredentials);
this.account = el('input', {type: 'text', name: 'game-account', autocomplete: 'username', 'aria-label': '游戏账号'});
this.password = el('input', {type: 'password', name: 'game-password', autocomplete: 'current-password', 'aria-label': '游戏密码'});
@@ -48,11 +48,9 @@ class LoginPage {
this.restore = el('button', {type: 'button', text: '恢复选中会话(无需重新输密码)', disabled: true, onClick: () => page.perform('restore_session', {session_id: this.saved.value}).catch(page.error)});
this.root.append(form,
field('第二步:区服 / 角色', el('div', {class: 'server-row'}, this.servers, this.enter)),
el('p', {class: 'info-note', text: '账号验证 → 获取官方区服 → 选择区服 → 进入区服 → 读取角色。在线时默认自动刷新状态并自动执行已勾选功能;顶部“停止”仅暂停执行,重新登录和服务重启后仍保持暂停,直到再次“开启”。'}),
el('div', {class: 'session-block policy-form'}, field('已保存账号 / 区服 / 角色', this.saved), el('div', {class: 'login-actions'}, this.restore)),
el('div', {class: 'page-toolbar'}, el('button', {type: 'button', text: '退出登录', onClick: () => page.perform('logout').catch(page.error)}),
el('button', {type: 'button', text: '退出并清除登录记录…', onClick: () => page.options.command('forget-login', page.account)})),
el('p', {class: 'info-note', text: '记住的账号密码和登录会话由服务端加密保存。浏览器不会保存游戏凭据。账号登录并保存原区服、原角色后会持续保持登录:掉线、退出登录或服务重启,均按设定时长自动重登并恢复监控;默认等待 30 分钟,可修改为 10 分钟等时长。关闭页面不影响自动重登。只有“退出并清除登录记录”或删除账号才取消自动重登;手动停止的执行仍保持暂停。'}));
el('button', {type: 'button', text: '退出并清除登录记录…', onClick: () => page.options.command('forget-login', page.account)})));
host.append(this.autoReloginStatus, this.root);
}
@@ -72,8 +70,9 @@ class LoginPage {
updateStatus() {
const status = this.page.account.summary?.auto_relogin_status;
const message = status?.message || '已保存的账号会持续自动重登,等待服务端状态;可设置重登等待时长。';
const message = status?.message || '';
if (this.autoReloginMessage.textContent !== message) this.autoReloginMessage.textContent = message;
this.autoReloginMessage.hidden = !message;
this.autoReloginCredentials.hidden = this.hasSavedPassword !== false;
const attemptAt = typeof status?.next_attempt_at === 'string' ? Date.parse(status.next_attempt_at) : NaN;
this.autoReloginCountdown.hidden = !Number.isFinite(attemptAt);
@@ -82,6 +81,7 @@ class LoginPage {
const countdown = remaining ? `${remaining} 秒后自动重新登录(${chinaTime(status.next_attempt_at, {date: true})},北京时间)` : '等待服务端执行自动重登';
if (this.autoReloginCountdown.textContent !== countdown) this.autoReloginCountdown.textContent = countdown;
}
this.autoReloginStatus.hidden = !message && this.autoReloginCountdown.hidden && this.autoReloginCredentials.hidden;
}
updateOptions(select, options, placeholder) {
@@ -105,11 +105,12 @@ export class PageView {
this.query = initialQuery(key);
this.filters = new Map();
this.data = null;
this.root = el('section', {class: 'page-panel', role: 'tabpanel', 'aria-label': PAGES.find(page => page[0] === key)[1], 'data-page': key, hidden: true});
this.root = el('section', {class: 'page-panel', role: 'tabpanel', 'aria-label': PAGES.find(page => page[0] === key)[1], 'aria-busy': 'false', 'data-page': key, hidden: true});
this.header = el('div', {class: 'page-header'});
this.title = el('h2', {text: PAGES.find(page => page[0] === key)[1]});
this.loading = el('span', {class: 'page-loading', role: 'status', text: '正在读取…', 'data-loading': 'true'});
this.header.append(this.title, this.loading);
this.loading = el('div', {class: 'page-loading loading-state', role: 'status', 'aria-label': `正在加载${this.title.textContent}`, 'data-loading': 'false', hidden: true},
el('span', {class: 'loading-spinner', 'aria-hidden': 'true'}));
this.header.append(this.title);
this.errorBox = el('div', {class: 'page-error', role: 'alert', hidden: true});
this.error = error => { this.showError(error.message || String(error)); notice(error.message || String(error), true); };
this.subtabs = el('div', {class: 'subtabs', role: 'tablist', 'aria-label': '子页面', hidden: true});
@@ -119,18 +120,32 @@ export class PageView {
this.formHost = el('div', {class: 'policy-form'});
this.actionsHost = el('div', {class: 'page-toolbar'});
this.content = el('div', {class: 'page-content'});
this.notes = el('div', {class: 'info-note'});
this.context = {get: (path, fallback) => getPath(account.config, path, fallback), set: (path, value, field, row) => options.edit(account, path, value, field, row),
dirty: path => account.edits.has(pathKey(path)), onError: this.error, onSelection: () => this.syncActions(),
onContext: (event, selected, row) => this.openContext(event, selected, row), onDetail: row => this.showDetail(row)};
this.form = new PolicyForm(this.formHost, this.context);
this.root.append(this.header, this.errorBox, this.subtabs, this.filterHost, this.summary, this.runtimeStatus, this.formHost, this.actionsHost, this.content, this.notes);
this.surface = el('div', {class: 'page-surface'}, this.errorBox, this.subtabs, this.filterHost, this.summary, this.runtimeStatus, this.formHost, this.actionsHost, this.content);
this.body = el('div', {class: 'page-body'}, this.surface, this.loading);
this.root.append(this.header, this.body);
if (key === 'login') this.login = new LoginPage(this.content, this);
tabKeys(this.subtabs, '.subtab');
}
perform(operation, payload = {}) { return this.options.perform(this.account, operation, payload, {page: this}); }
showError(message) { this.errorBox.replaceChildren(el('span', {text: message}), el('button', {text: '重新读取', type: 'button', onClick: () => this.options.load(this, true)})); this.errorBox.hidden = false; }
setLoading(loading) {
const busy = Boolean(loading && !this.root.hidden && this.root.isConnected);
if (this.loading.dataset.loading === String(busy)) return;
clearTimeout(this.loadingTimer);
this.root.setAttribute('aria-busy', String(busy));
this.loading.dataset.loading = String(busy);
this.loading.hidden = true;
// Skip the visual flash for fast reads; expose busy status immediately.
if (busy) this.loadingTimer = setTimeout(() => {
if (!this.root.hidden && this.root.isConnected) this.loading.hidden = false;
else this.setLoading(false);
}, 150);
}
showError(message) { this.setLoading(false); this.errorBox.replaceChildren(el('span', {text: message}), el('button', {text: '重新读取', type: 'button', onClick: () => this.options.load(this, true)})); this.errorBox.hidden = false; }
clearError() { this.errorBox.hidden = true; }
setQuery(key, value) {
@@ -219,15 +234,14 @@ export class PageView {
$$('button[data-selection]', this.actionsHost).forEach(button => { button.disabled = !selected; });
}
render(data, loading = false) {
if (!data) { this.loading.textContent = '正在读取…'; this.loading.dataset.loading = 'true'; return; }
render(data) {
if (!data) return;
this.data = data;
this.loading.dataset.loading = String(loading);
this.loading.textContent = loading ? '后台更新中…' : '已载入';
this.updateSubtabs(data);
this.updateFilters(data.filters || []);
this.summary.textContent = typeof data.summary === 'string' ? data.summary : textValue(data.summary || '');
this.updateRuntimeStatus(data.details || {});
this.summary.hidden = !data.summary;
this.updateRuntimeStatus(data.details || {}, data.battle_mode);
let fields = data.form || this.options.schema(this.key);
if (this.key === 'login') fields = fields.filter(field => !(field.path?.[0] === 'auto_relogin' && field.path[1] === 'enabled'));
fields=fields.map(field=>field.path?.[0]==='policy'&&field.path[1]==='buy_ten'?{...field,disabled:!this.account.config?.policy?.allow_single_draw}:field);
@@ -238,11 +252,6 @@ export class PageView {
if (this.login) { this.login.update(data); return; }
this.content.hidden = policyTab;
if (policyTab) return;
const notes = data.notes || data.details?.note || data.details?.notes || data.details?.help || data.hint || '';
const noteText=Array.isArray(notes)?notes.join('\n'):typeof notes==='string'?notes:textValue(notes);
this.notes.textContent=[noteText,...(data.battle_mode?[data.battle_mode.label,data.battle_mode.damage_rule]:[])].filter(Boolean).join('\n');
this.notes.style.whiteSpace = 'pre-wrap';
this.notes.hidden = !this.notes.textContent;
const groups = data.groups || [];
const grouped = this.key === 'maps' || this.key === 'ranch' && (this.query.grouped === true || this.query.grouped === 'true');
const mode = this.key === 'statistics' ? 'statistics' : grouped ? 'grouped' : 'table';
@@ -250,7 +259,7 @@ export class PageView {
if (this.content.contains(document.activeElement)) return;
this.content.replaceChildren();
this.contentMode = mode;
this.table = mode === 'grouped' ? new GroupedTables(this.content, this.context, {collapsed: this.key === 'maps'}) : mode === 'table' ? new DataTable(this.content, this.context, {emptyMessage: this.key === 'plans' ? '当前没有执行计划。请配置策略并刷新 / 预览,查看下一步或等待原因。' : '当前筛选下没有条目。可调整筛选,或登录后刷新状态。'}) : null;
this.table = mode === 'grouped' ? new GroupedTables(this.content, this.context, {collapsed: this.key === 'maps'}) : mode === 'table' ? new DataTable(this.content, this.context, {emptyMessage: this.key === 'plans' ? '当前没有执行计划。' : '当前筛选下没有条目。'}) : null;
if (mode === 'statistics') this.buildStatistics();
}
if (mode === 'statistics') this.renderStatistics(data);
@@ -260,7 +269,7 @@ export class PageView {
} else this.table.update(data.columns || [], data.rows || []);
}
updateRuntimeStatus(details) {
updateRuntimeStatus(details, battleMode) {
const lines=[];
if(this.key==='hatching'){
if(this.activeSubtab==='喂养策略' && Array.isArray(details.feed_status))lines.push(['feed_status','当前喂养状态:'+textValue(details.feed_status[1])]);
@@ -270,7 +279,16 @@ export class PageView {
const ready=details.next_ready_at;
lines.push(['next_ready_at',ready===null?'下次赠礼:当前没有符合条件的目标或物品,等待状态更新':'下次可赠礼:'+chinaTime(ready,{date:true})+'(北京时间)']);
}
this.runtimeStatus.replaceChildren(...lines.map(([key,text])=>el('p',{'data-view-status':key,text})));
// Planner notes are current execution/wait reasons, unlike DTO help text.
const notes = Array.isArray(details.notes) ? [...new Set(details.notes.filter(note => typeof note === 'string' && note.trim()))] : [];
if(notes.length)lines.push(['planner_notes',notes.join('\n')]);
if(details.statistics_error)lines.push(['statistics_error',textValue(details.statistics_error)]);
if(battleMode?.label)lines.push(['battle_mode',battleMode.label]);
const signature=JSON.stringify(lines);
if(signature!==this.runtimeSignature){
this.runtimeStatus.replaceChildren(...lines.map(([key,text])=>el('p',{'data-view-status':key,text})));
this.runtimeSignature=signature;
}
this.runtimeStatus.hidden=!lines.length;
}
@@ -279,7 +297,7 @@ export class PageView {
if (!data) return;
const labels = {name:'名称',species:'种类',id:'魔物ID',level:'等级 / 当前上限',quality:'资质 攻/防/血/敏',reference_stats:'参考攻击 / 防御 / 生命 / 敏捷',growth:'成长数值',likes:'喜欢的物品',feel:'好感 / 上限',feed_exp:'喂养经验',scope:'管理范围'};
const title=this.key==='ranch'?'魔物详情':this.key==='mainline'?'任务详情':this.key==='battles'?'战斗详情':'详情';
dialog(title, el('div', {class:'detail-sections'}, detailsList(data, labels), this.key==='ranch'?el('p', {class:'info-note',text:'参考属性不含装备、羁绊或全局加成。'}):null), {info:true});
dialog(title, el('div', {class:'detail-sections'}, detailsList(data, labels)), {info:true});
}
openContext(event, selected, row) {
@@ -296,7 +314,7 @@ export class PageView {
this.statisticsPicker = el('div', {class:'statistics-picker',role:'listbox','aria-label':'关卡 / 难度'});
this.chart = el('div',{class:'chart-scroll','aria-label':'掉落统计图'});
this.statisticsTableHost = el('div',{class:'statistics-table-host'});
this.statisticsTable = new DataTable(this.statisticsTableHost,this.context,{selection:false,emptyMessage:'所选关卡尚无已确认样本;完成扫荡后将显示实际统计。'});
this.statisticsTable = new DataTable(this.statisticsTableHost,this.context,{selection:false,emptyMessage:'所选关卡尚无已确认样本。'});
this.statisticsSummary = el('p',{class:'page-summary'});
this.content.append(el('div',{class:'statistics-layout'},this.statisticsPicker,el('div',{class:'statistics-main'},this.statisticsSummary,this.chart,this.statisticsTableHost)));
}
@@ -358,7 +376,7 @@ export class PageView {
if (this.chartSignature === signature) return;
this.chartSignature = signature;
this.chart.replaceChildren();
if (!bars.length) { this.chart.append(empty(emptyReason || '暂无已确认的统计样本。图表将随实际扫荡记录生成。')); return; }
if (!bars.length) { this.chart.append(empty(emptyReason || '暂无已确认的统计样本。')); return; }
const ns='http://www.w3.org/2000/svg', width=760, height=Math.max(120,bars.length*29+50), labelWidth=175;
const svg=document.createElementNS(ns,'svg');
svg.setAttribute('viewBox',`0 0 ${width} ${height}`);svg.setAttribute('class','drop-chart');svg.setAttribute('role','img');svg.setAttribute('aria-label',metric==='per_stamina'?'每点体力掉落数量':'实测掉落率');
+16 -2
View File
@@ -2,7 +2,7 @@
*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit;color:inherit}button,select,input[type=number],input[type=text],input[type=password],input[type=search],textarea{border:1px solid #afb8c2;border-radius:3px;background:#fff;min-height:27px}button{padding:3px 10px;cursor:pointer;white-space:nowrap;background:#f8f9fb}button:hover{background:#e9edf2;border-color:#8291a1}button:active{background:#dce4ed}button:disabled,input:disabled,select:disabled{cursor:default;opacity:.58}input,select{padding:2px 6px}input[type=checkbox]{width:14px;height:14px;min-height:0;margin:0 4px 0 0;accent-color:var(--accent);vertical-align:middle;flex-shrink:0}input[type=number]{font-variant-numeric:tabular-nums;min-width:62px;width:88px}input[type=search]{min-width:170px}select{max-width:100%}textarea{padding:6px;resize:vertical;min-height:60px}button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,[tabindex]:focus-visible,a:focus-visible{outline:2px solid var(--accent);outline-offset:2px}::selection{background:#c5dbf5;color:#142b46}input,textarea{caret-color:var(--accent)}[hidden]{display:none!important}h1,h2,h3,p{margin:0}h1{font-size:16px;font-weight:600}h2,h3{font-size:14px;font-weight:600}p{line-height:1.65}a{color:var(--accent);text-underline-offset:3px}.muted{color:var(--muted);font-size:12px}.spacer{flex:1}.primary{background:#245d9b;color:#fff;border-color:#245d9b}.primary:hover{background:#1c4d83;color:#fff}.danger{color:#94231d;border-color:#c39c99}.error-text{color:#99251e;white-space:pre-wrap;overflow-wrap:anywhere}.small,.compact{min-height:24px;padding:2px 8px;font-size:12px}
.workbench{height:100dvh;min-height:420px;display:flex;flex-direction:column;overflow:hidden}.window-header{display:flex;align-items:center;min-height:29px;gap:16px;padding:0 10px 0 4px;border-bottom:1px solid var(--border);background:#f6f7f9}.window-title{font-size:12px;color:#404c59}.window-title #app-version{margin-left:5px;color:var(--muted)}#access-mode{margin-left:auto}.menu-bar{display:flex;gap:1px}.menu{position:relative}.menu>summary{list-style:none;padding:5px 9px;cursor:pointer;border-radius:2px}.menu>summary::-webkit-details-marker{display:none}.menu[open]>summary,.menu>summary:hover{background:#dfe8f3}.access-key{font-size:11px;margin-left:3px;color:var(--muted)}.menu-popup{position:absolute;top:100%;left:0;z-index:30;min-width:220px;padding:4px;background:#fff;border:1px solid #acb6c1;box-shadow:0 5px 14px #172a4026}.menu-popup button{display:block;width:100%;border:0;border-radius:0;text-align:left;background:transparent;padding:6px 12px}.menu-popup button:hover{background:var(--tint)}.menu-popup hr{border:0;border-top:1px solid var(--border);margin:4px 2px}
.account-bar{display:flex;gap:6px;align-items:center;padding:5px 6px 0;min-height:36px;background:#e7ebef;border-bottom:1px solid var(--border)}.account-tabs{display:flex;overflow-x:auto;gap:3px;align-self:stretch;min-width:0;scrollbar-width:thin}.account-tab{border-radius:4px 4px 0 0;border:1px solid var(--border);border-bottom:0;display:flex;gap:6px;align-items:center;max-width:230px;background:#f1f3f5;min-height:30px;padding:4px 13px}.account-tab[aria-selected=true]{background:#fff;box-shadow:inset 0 2px 0 var(--accent)}.account-tab .account-label{overflow:hidden;text-overflow:ellipsis}.account-dot{width:6px;height:6px;border-radius:50%;background:#7b8490;flex-shrink:0}.account-dot.running{background:var(--green)}.account-dot.error{background:var(--danger)}#add-account{margin:0 0 5px;flex-shrink:0}.toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:8px 18px;padding:8px 8px 5px;background:#fff}.player-line{display:flex;align-items:center;flex-wrap:wrap;gap:12px;min-height:27px;flex:1 1 auto}.player-line>span{white-space:nowrap}.player-line b{font-weight:600;font-variant-numeric:tabular-nums}.player-line>strong{max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.connection{font-size:12px;color:var(--muted)}.connection.online{color:#176331}.connection.demo{color:#805300}.experience{display:inline-flex;gap:5px;align-items:center}progress{width:58px;height:6px;accent-color:var(--accent)}progress::-webkit-progress-bar{background:#e2e7ee;border-radius:2px}progress::-webkit-progress-value{background:#467aa9;border-radius:2px}.run-controls{display:flex;align-items:center;gap:5px;flex-wrap:wrap}.run-controls>label{display:flex;align-items:center;gap:5px}.run-button{min-width:76px;font-weight:600;background:var(--green);border-color:#185b2d;color:#fff}.run-button:hover{background:#1b6332;color:#fff;border-color:#185b2d}.run-button.running{background:var(--danger);border-color:#8f1e18}.run-button.running:hover{background:#992019}.run-button:disabled{opacity:1;background:#727b82;border-color:#727b82}.summary-line{display:flex;gap:10px;align-items:center;min-height:25px;padding:2px 8px 5px;background:#fff;font-size:12px;color:var(--muted)}#data-summary{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1}#save-status{flex-shrink:0}#save-status.pending{color:#805300}#save-status.failed{color:#99251e}
.workspace{display:flex;flex-direction:column;flex:1;min-height:155px;padding:0 6px;overflow:hidden;background:#fff}.page-tabs{display:flex;flex-shrink:0;overflow-x:auto;gap:0;border-bottom:1px solid #9eabb9;scrollbar-width:thin}.page-tab{border-radius:3px 3px 0 0;border:1px solid transparent;background:#f1f3f5;padding:6px 10px;min-height:30px;margin-right:1px;font-size:12px}.page-tab[aria-selected=true]{background:#fff;border-color:#9eabb9;border-bottom-color:#fff;color:#174d83;box-shadow:inset 0 2px 0 #245d9b;font-weight:600}.page-tab:hover{background:#e8f0f9}.page-host{flex:1;min-height:0;overflow:hidden;position:relative}.page-panel{height:100%;display:flex;flex-direction:column;overflow:auto;padding:7px 2px 4px;gap:7px;scrollbar-gutter:stable}.page-header{display:flex;gap:8px;align-items:center;flex-wrap:wrap;min-height:25px}.page-header h2{margin-right:7px}.page-summary{color:var(--muted);font-size:12px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}.page-toolbar,.filter-bar{display:flex;flex-wrap:wrap;gap:5px 9px;align-items:center}.filter-bar label{display:inline-flex;gap:5px;align-items:center}.page-loading{font-size:12px;color:var(--muted);margin-left:auto}.page-loading[data-loading=true]::before{content:"";display:inline-block;width:7px;height:7px;background:#688aaf;border-radius:50%;margin-right:5px}.subtabs{display:flex;gap:2px;border-bottom:1px solid var(--border);flex-shrink:0}.subtab{background:#f0f2f5;border:1px solid var(--border);border-bottom:0;border-radius:3px 3px 0 0;font-size:12px;padding:4px 10px}.subtab[aria-selected=true]{background:#e8f0f9;color:#174d83;border-color:#94adc7}.initial-state,.empty-state{padding:24px 18px;color:var(--muted);line-height:1.8}.empty-state p{max-width:65ch}.empty-state button{margin-top:12px}.page-error{padding:8px 10px;background:#fff4f3;border:1px solid #ddbbb7;color:#8e251f;display:flex;align-items:center;gap:10px;white-space:pre-wrap}.info-note{font-size:12px;color:var(--muted);line-height:1.65;padding:5px 0;max-width:115ch}.inline-note{color:var(--muted);font-size:12px}
.workspace{display:flex;flex-direction:column;flex:1;min-height:155px;padding:0 6px;overflow:hidden;background:#fff}.page-tabs{display:flex;flex-shrink:0;overflow-x:auto;gap:0;border-bottom:1px solid #9eabb9;scrollbar-width:thin}.page-tab{border-radius:3px 3px 0 0;border:1px solid transparent;background:#f1f3f5;padding:6px 10px;min-height:30px;margin-right:1px;font-size:12px}.page-tab[aria-selected=true]{background:#fff;border-color:#9eabb9;border-bottom-color:#fff;color:#174d83;box-shadow:inset 0 2px 0 #245d9b;font-weight:600}.page-tab:hover{background:#e8f0f9}.page-host{flex:1;min-height:0;overflow:hidden;position:relative}.page-panel{height:100%;display:flex;flex-direction:column;overflow:auto;padding:7px 2px 4px;gap:7px;scrollbar-gutter:stable}.page-header{display:flex;gap:8px;align-items:center;flex-wrap:wrap;min-height:25px}.page-header h2{margin-right:7px}.page-summary{color:var(--muted);font-size:12px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}.page-toolbar,.filter-bar{display:flex;flex-wrap:wrap;gap:5px 9px;align-items:center}.filter-bar label{display:inline-flex;gap:5px;align-items:center}.subtabs{display:flex;gap:2px;border-bottom:1px solid var(--border);flex-shrink:0}.subtab{background:#f0f2f5;border:1px solid var(--border);border-bottom:0;border-radius:3px 3px 0 0;font-size:12px;padding:4px 10px}.subtab[aria-selected=true]{background:#e8f0f9;color:#174d83;border-color:#94adc7}.initial-state,.empty-state{padding:24px 18px;color:var(--muted);line-height:1.8}.empty-state p{max-width:65ch}.empty-state button{margin-top:12px}.page-error{padding:8px 10px;background:#fff4f3;border:1px solid #ddbbb7;color:#8e251f;display:flex;align-items:center;gap:10px;white-space:pre-wrap}.info-note{font-size:12px;color:var(--muted);line-height:1.65;padding:5px 0;max-width:115ch}.inline-note{color:var(--muted);font-size:12px}
.table-scroll{overflow:auto;min-height:80px;flex:1;border:1px solid var(--border);background:#fff;position:relative}.data-table{border-collapse:separate;border-spacing:0;width:100%;font-size:12px;white-space:nowrap;text-align:left;font-variant-numeric:tabular-nums}.data-table th{position:sticky;top:0;z-index:2;background:#eef1f5;color:#303d4c;font-weight:500;border-bottom:1px solid #bac4cf;border-right:1px solid #d5dbe2;height:28px;padding:3px 8px;white-space:nowrap}.data-table th button{font:inherit;border:0;background:transparent;padding:0;min-height:20px;display:flex;align-items:center;gap:6px;width:100%;text-align:left}.data-table th .sort-mark{color:#506a85;font-size:10px;min-width:8px}.data-table td{border-bottom:1px solid #e4e8ed;border-right:1px solid #eef0f3;padding:2px 7px;height:29px;max-width:300px;overflow:hidden;text-overflow:ellipsis}.data-table tr:nth-child(even)>td{background:#fafbfc}.data-table tr:hover>td{background:#f0f5fa}.data-table tr[aria-selected=true]>td{background:#dfecfa}.data-table td.number{text-align:right}.data-table td.cell-edit{padding:2px 4px;overflow:visible}.data-table td.cell-edit input[type=number]{min-height:24px;height:24px;width:76px;font-size:12px}.data-table td.cell-edit select{min-height:24px;height:24px;font-size:12px;max-width:220px}.data-table td.cell-edit input[type=text]{min-height:24px;width:140px;font-size:12px}.data-table .selection-cell{width:29px;min-width:29px;text-align:center;padding:0 5px;position:sticky;left:0;z-index:1}.data-table th.selection-cell{z-index:3}.data-table .cell-wrap{white-space:normal;min-width:190px;line-height:1.5}.data-table .cell-ellipsis{max-width:260px}.data-table .cell-boolean{color:#176331}.table-footer{display:flex;gap:12px;align-items:center;min-height:20px;font-size:12px;color:var(--muted)}.table-footer>button{margin-left:auto}.grouped-tables{display:flex;flex-direction:column;gap:5px;overflow:auto;flex:1;min-height:100px}.table-group{border:1px solid var(--border);background:#fff}.table-group>summary{cursor:pointer;font-weight:600;font-size:12px;padding:7px 9px;background:#eef1f5;position:sticky;top:0;z-index:3}.table-group>summary small{font-weight:400;color:var(--muted);margin-left:10px}.table-group .table-scroll{border:0;max-height:410px}.table-group .data-table th{top:0}.table-group .table-footer{padding:3px 8px}
.policy-form{display:flex;flex-direction:column;gap:9px;flex-shrink:0}.form-section{margin:0;border:1px solid #d6dce3;padding:7px 10px 10px;min-width:0}.form-section legend{font-size:12px;font-weight:600;padding:0 5px;color:#344458}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(270px,1fr));gap:7px 22px;max-width:1100px}.field{display:flex;align-items:center;gap:8px;min-width:0;font-size:12px}.field>.field-label{min-width:135px;flex:0 1 195px;line-height:1.5}.field>.field-input{flex:1;min-width:0;max-width:310px}.field input[type=number].field-input{max-width:130px}.field.checkbox-field{min-height:27px}.field-help{font-size:12px;color:var(--muted);line-height:1.5;display:block;grid-column:1/-1}.field-wide{grid-column:1/-1}.field.invalid input{border-color:var(--danger)}.field[data-dirty=true] .field-label::after{content:" ·";color:#805300}.inline-editor{display:inline-flex;align-items:center;gap:3px}.multi-select{display:flex;flex-wrap:wrap;gap:4px 12px;padding:4px 0;min-width:0}.multi-select label{display:inline-flex;align-items:center;gap:2px}.member-selects{display:flex;gap:3px;flex-wrap:wrap;align-items:center}.member-selects select{width:165px}.member-selects button{min-height:24px}.login-layout{max-width:790px;display:flex;flex-direction:column;gap:10px;padding:4px 8px}.login-layout .form-grid{grid-template-columns:1fr}.login-layout input[type=text],.login-layout input[type=password]{width:320px;max-width:100%}.login-layout .field>.field-label{flex-basis:145px;min-width:145px}.login-layout .field>.field-input{max-width:none}.login-options{display:flex;gap:14px;margin-left:153px;font-size:12px}.login-actions{display:flex;gap:6px;margin-left:153px;flex-wrap:wrap}.server-row{display:flex;gap:6px;flex:1;min-width:0}.server-row select{min-width:180px;flex:1}.session-block{margin-top:4px;padding-top:14px;border-top:1px solid var(--border)}.demo-note{font-size:12px;color:#805300;background:#fff9ea;border:1px solid #e1d0a7;padding:6px 9px;line-height:1.6}.detail-list{display:grid;grid-template-columns:max-content 1fr;gap:6px 18px;font-size:12px}.detail-list dt{color:var(--muted)}.detail-list dd{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.detail-sections{display:flex;flex-direction:column;gap:12px}.statistics-layout{display:flex;gap:9px;min-height:180px;flex:1}.statistics-picker{width:260px;flex-shrink:0;overflow:auto;border:1px solid var(--border)}.statistics-picker button{display:block;border:0;border-radius:0;width:100%;text-align:left;overflow:hidden;text-overflow:ellipsis;font-size:12px}.statistics-picker button[aria-selected=true]{background:var(--tint);color:#174d83}.statistics-main{min-width:0;flex:1;display:flex;flex-direction:column;gap:8px}.chart-scroll{min-height:120px;max-height:310px;overflow:auto;border:1px solid var(--border);padding:8px}.drop-chart{display:block;min-width:450px;width:100%;height:auto}.chart-label{font-size:12px;fill:#344458}.chart-value{font-size:11px;fill:#344458;font-variant-numeric:tabular-nums}.chart-bar{fill:#4979a4}.chart-grid{stroke:#e3e7ed;stroke-width:1}
.log-resizer{height:7px;min-height:7px;cursor:row-resize;background:#e3e7ec;position:relative;border-top:1px solid #b8c1cb;border-bottom:1px solid #c8d0d9}.log-resizer::after{content:"";position:absolute;width:34px;height:2px;background:#8f9ba8;left:calc(50% - 17px);top:2px}.log-resizer:hover{background:#cedbe9}.log-panel{height:var(--log-height);min-height:64px;max-height:55vh;display:flex;flex-direction:column;background:#fff}.log-toolbar{display:flex;gap:13px;align-items:center;padding:3px 8px;background:#f1f3f5;border-bottom:1px solid var(--border);min-height:29px;font-size:12px}.log-toolbar strong{font-weight:600}.log-toolbar label{display:flex;align-items:center;gap:2px}.log-lines{padding:4px 9px;overflow:auto;flex:1;font:12px/1.65 Consolas,"Microsoft YaHei UI",monospace;white-space:pre-wrap;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}.log-entry{min-height:19px}.log-entry .log-time{color:#6a7480;margin-right:8px}.log-entry.error{color:#99251e}.log-entry.warning{color:#805300}.log-entry.debug{color:#55616e}.status-bar{min-height:24px;display:flex;align-items:center;gap:14px;padding:3px 8px;border-top:1px solid var(--border);background:#f1f3f5;font-size:12px;overflow:hidden;white-space:nowrap}.status-bar #status-text{overflow:hidden;text-overflow:ellipsis;max-width:50vw}.status-bar #job-status{overflow:hidden;text-overflow:ellipsis}.notice{position:fixed;right:16px;bottom:35px;max-width:min(540px,calc(100vw - 32px));background:#eef5fc;color:#1d456d;border:1px solid #99b5d1;padding:10px 14px;z-index:80;box-shadow:0 4px 14px #1b2d4326;font-size:13px;line-height:1.5;white-space:pre-wrap}.notice.error{background:#fff2f0;border-color:#d2aaa5;color:#99251e}dialog{border:1px solid #a4afbb;border-radius:5px;padding:0;max-width:min(740px,calc(100vw - 28px));width:560px;max-height:88dvh;background:#fff;color:#202832;box-shadow:0 12px 44px #172a4040}dialog::backdrop{background:#152d493d}dialog>form{display:flex;flex-direction:column;max-height:85dvh}.dialog-header{display:flex;align-items:center;gap:12px;padding:10px 14px;border-bottom:1px solid var(--border);background:#f4f6f8}.dialog-close{margin-left:auto;border:0;background:transparent;padding:0 5px;font-size:22px;line-height:1}.dialog-content{padding:14px;overflow:auto;display:flex;flex-direction:column;gap:12px;min-height:40px}.dialog-content p{font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere}.dialog-content .field{align-items:flex-start}.dialog-content .field input{flex:1;min-width:0}.dialog-content .form-grid{grid-template-columns:1fr}.dialog-footer{display:flex;justify-content:flex-end;gap:7px;padding:10px 14px;border-top:1px solid var(--border);background:#f6f7f9}#dialog-error{padding:0 14px 10px}#auth-dialog{width:370px;padding:18px}#auth-dialog form{gap:13px}#auth-dialog .dialog-footer{margin:0 -18px -18px}#auth-dialog .field{display:flex;flex-direction:column;align-items:stretch;gap:6px}.context-menu{position:fixed;z-index:50;background:#fff;border:1px solid #acb6c1;box-shadow:0 5px 14px #172a4026;padding:4px;min-width:190px}.context-menu button{display:block;width:100%;text-align:left;background:transparent;border:0;border-radius:0;padding:5px 10px}.context-menu button:hover{background:var(--tint)}
@@ -10,7 +10,21 @@
@media(max-width:1000px){.window-title{display:none}.toolbar{gap:5px}.run-controls{width:100%}.player-line{gap:10px}.page-tab{padding-left:8px;padding-right:8px}.form-grid{grid-template-columns:repeat(2,minmax(240px,1fr))}.statistics-picker{width:220px}}
@media(max-width:650px){:root{--log-height:120px}.workbench{min-width:340px}.window-header{gap:5px}.menu>summary{padding:5px 7px}.access-key{display:none}#access-mode{font-size:11px}.toolbar{padding:6px}.player-line{gap:7px 10px}.player-line>strong{max-width:135px}.experience progress{display:none}.run-controls{gap:4px}.run-controls>button{padding-left:7px;padding-right:7px;font-size:12px}.form-grid{grid-template-columns:1fr}.field>.field-label{min-width:120px}.field-wide{grid-column:auto}.login-layout{padding:3px}.login-layout .field{align-items:stretch;flex-direction:column;gap:4px}.login-layout .field>.field-label{flex-basis:auto;min-width:0}.login-layout input[type=text],.login-layout input[type=password]{width:100%}.login-options,.login-actions{margin-left:0}.server-row{flex-wrap:wrap}.statistics-layout{flex-direction:column}.statistics-picker{width:100%;max-height:130px}.log-toolbar{gap:7px}#download-log{display:none}.status-bar{gap:8px}.status-bar #game-version{display:none}dialog .field{flex-direction:column;align-items:stretch}dialog .field-label{flex-basis:auto}#save-status{max-width:160px;overflow:hidden;text-overflow:ellipsis}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
.page-content{display:flex;flex-direction:column;gap:7px;flex:1;min-height:160px;overflow:auto}.page-panel[data-page=login]>.page-content{flex:0 0 auto;min-height:0;overflow:visible}.statistics-table-host{display:flex;flex-direction:column;flex:1;min-height:100px}.count-id{width:100px}.statistics-city>summary,.statistics-stage>summary{cursor:pointer;font-size:12px;padding:6px 7px;line-height:1.5;overflow-wrap:anywhere}.statistics-city>summary{background:#eef1f5;border-bottom:1px solid #d8dee6;font-weight:600}.statistics-stage{margin-left:10px}.statistics-stage>summary:hover{background:#edf3fa}.statistics-levels{padding-left:12px}.statistics-levels button{padding:5px 8px}.debug-json{margin:0;font:12px/1.6 Consolas,monospace;white-space:pre-wrap;overflow-wrap:anywhere}.log-entry.inspectable{cursor:pointer}.log-entry.inspectable:hover{background:#e8f0f9}.member-draft-note{font-size:11px;color:#805300}.counts-lines{display:flex;flex-direction:column;gap:3px;margin-bottom:4px}
.page-content{display:flex;flex-direction:column;gap:7px;flex:1;min-height:160px;overflow:auto}.page-panel[data-page=login] .page-content{flex:0 0 auto;min-height:0;overflow:visible}.statistics-table-host{display:flex;flex-direction:column;flex:1;min-height:100px}.count-id{width:100px}.statistics-city>summary,.statistics-stage>summary{cursor:pointer;font-size:12px;padding:6px 7px;line-height:1.5;overflow-wrap:anywhere}.statistics-city>summary{background:#eef1f5;border-bottom:1px solid #d8dee6;font-weight:600}.statistics-stage{margin-left:10px}.statistics-stage>summary:hover{background:#edf3fa}.statistics-levels{padding-left:12px}.statistics-levels button{padding:5px 8px}.debug-json{margin:0;font:12px/1.6 Consolas,monospace;white-space:pre-wrap;overflow-wrap:anywhere}.log-entry.inspectable{cursor:pointer}.log-entry.inspectable:hover{background:#e8f0f9}.member-draft-note{font-size:11px;color:#805300}.counts-lines{display:flex;flex-direction:column;gap:3px;margin-bottom:4px}
.chart-axis{font-size:11px;fill:#55616e;font-variant-numeric:tabular-nums}
#log-lines{overflow-anchor:none;overscroll-behavior:contain}
.log-toolbar{flex-wrap:wrap;gap:5px 13px}.log-toolbar input[type=search]{width:170px;min-width:100px;max-width:100%}
.loading-state{display:grid;place-items:center;min-height:160px;align-self:stretch;flex:1}
.page-host>.loading-state{height:100%}
.loading-region{display:grid;min-height:160px}
.loading-region>*{grid-area:1/1}
.loading-region>.loading-state{z-index:4;pointer-events:none}
.loading-spinner{display:block;width:32px;height:32px;border:3px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:loading-spin .8s linear infinite;box-shadow:0 0 0 4px #ffffffb3}
@keyframes loading-spin{to{transform:rotate(360deg)}}
.page-header{flex-shrink:0}
.page-body{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);flex:1;min-width:0;min-height:160px;position:relative}
.page-surface{grid-area:1/1;display:flex;flex-direction:column;gap:7px;min-width:0;min-height:0;overflow:auto;scrollbar-gutter:stable}
.page-surface>:not(.page-content){flex-shrink:0}
.page-loading{grid-area:1/1;z-index:4;pointer-events:none;min-height:0}
@media(prefers-reduced-motion:reduce){.loading-spinner{animation:none}}