- 设置页重写进 AppShell:生成与队列 / 智能体运行 / 存储路径三段,其余设置入口链到模型设置、ComfyUI 连接、智能体;旧 ?tab= 链接跳转到对应新页 - 项目卡状态标签改为按五段真实进度显示(已完成 / 某阶段生成中·待确认 / 进行中 / 待开始) - 首页生成任务行对齐 a1(来源标签、项目名、进度条、本地时间) - 连接页:右栏默认新增表单 + 任务使用目标面板,进入页面自动实测各连接;模型页默认新增表单、自动 1-token 实测,去掉双加号 - 生图/生视频:生成参数面板标题、通栏生成按钮、成片预览、按类型的历史标题与 16:9 视频历史、顶栏连接状态胶囊,连接状态改用服务器实测 - 智能体页:五个 Agent / Skill 库 / 已装 Skill 面板标题,内置 Skill 中文名,去掉对话空态 Calliope 字样 - 侧栏底部 ComfyUI 状态修正为真实实测(原查询不响应导致一直测试中) - 统一样式来源:.a-btn/.a-panel/.a-select/.status-chip 等只在 app.css 定义一次,删除各页重复定义;新增 Switch、Button block、ProgressBar tone - 旧 Calliope 路由(/projects、/project/:id、/canvas、/library、/build-scene、/playground)重定向到 A 页面;页面标题改为影工坊 - 轮询间隔单位改为秒(7 种语言) Co-authored-by: multica-agent <github@multica.ai>
733 lines
22 KiB
Svelte
733 lines
22 KiB
Svelte
<script lang="ts">
|
|
import { beforeNavigate, goto, afterNavigate } from '$app/navigation';
|
|
import { createMutation, createQuery, useQueryClient } from '@tanstack/svelte-query';
|
|
import AppShell from '$lib/components/shell/AppShell.svelte';
|
|
import MemoryPanel from '$lib/components/settings/MemoryPanel.svelte';
|
|
import Button from '$lib/components/ui/Button.svelte';
|
|
import ConfirmDialog from '$lib/components/ui/ConfirmDialog.svelte';
|
|
import Icon from '$lib/components/ui/Icon.svelte';
|
|
import type { IconName } from '$lib/components/ui/icons';
|
|
import Switch from '$lib/components/ui/Switch.svelte';
|
|
import { settings, type Settings } from '$lib/api';
|
|
import { toast } from '$lib/toast';
|
|
import { t } from '$lib/i18n.svelte';
|
|
|
|
/**
|
|
* 设置 — A「片场暗房」shell (spec-v2 §3 nav item). Only the settings
|
|
* that have no dedicated page live here: generation queue, agent runtime
|
|
* and storage paths. LLMs, ComfyUI connections / workflows and Skills are
|
|
* managed on 模型设置 / ComfyUI 连接 / 智能体 — one place per setting.
|
|
*/
|
|
|
|
type Section = 'queue' | 'agent' | 'storage';
|
|
|
|
const SECTIONS: { id: Section; labelKey: string; blurbKey: string; icon: IconName }[] = [
|
|
{ id: 'queue', labelKey: 'settings.secQueue', blurbKey: 'settings.secQueueBlurb', icon: 'queue' },
|
|
{ id: 'agent', labelKey: 'settings.secAgent', blurbKey: 'settings.secAgentBlurb', icon: 'sparkle' },
|
|
{ id: 'storage', labelKey: 'settings.secStorage', blurbKey: 'settings.secStorageBlurb', icon: 'folder' },
|
|
];
|
|
|
|
const ELSEWHERE: { href: string; labelKey: string; blurbKey: string; icon: IconName }[] = [
|
|
{ href: '/models', labelKey: 'shell.navModels', blurbKey: 'settings.linkModelsBlurb', icon: 'assets' },
|
|
{ href: '/connections', labelKey: 'shell.navConnections', blurbKey: 'settings.linkConnectionsBlurb', icon: 'link' },
|
|
{ href: '/agents', labelKey: 'shell.navAgents', blurbKey: 'settings.linkAgentsBlurb', icon: 'sparkle' },
|
|
];
|
|
|
|
// Old Calliope tab links (/settings?tab=llm …) land on the page that now
|
|
// owns that setting instead of a dead tab.
|
|
const MOVED_TABS: Record<string, string> = {
|
|
llm: '/models',
|
|
workflows: '/connections',
|
|
skills: '/agents',
|
|
};
|
|
|
|
const client = useQueryClient();
|
|
let tab = $state<Section>('queue');
|
|
|
|
afterNavigate((nav) => {
|
|
const raw = nav.to?.url.searchParams.get('tab') || 'queue';
|
|
if (MOVED_TABS[raw]) {
|
|
goto(MOVED_TABS[raw], { replaceState: true });
|
|
return;
|
|
}
|
|
tab = raw === 'comfy' ? 'queue' : SECTIONS.some((s) => s.id === raw) ? (raw as Section) : 'queue';
|
|
});
|
|
|
|
const settingsQuery = createQuery({
|
|
queryKey: ['settings'],
|
|
queryFn: settings.get,
|
|
});
|
|
|
|
let draft = $state<Record<string, unknown>>({});
|
|
|
|
const dirtyKeys = $derived(Object.keys(draft).filter((k) => draft[k] !== undefined));
|
|
const isDirty = $derived(dirtyKeys.length > 0);
|
|
|
|
const FIELD_SECTION: Record<string, Section> = {
|
|
dry_run: 'queue',
|
|
queue_concurrency: 'queue',
|
|
queue_poll_interval_sec: 'queue',
|
|
queue_poll_timeout_sec: 'queue',
|
|
queue_max_retries: 'queue',
|
|
agent_max_steps: 'agent',
|
|
agent_hardening_prompt: 'agent',
|
|
agent_history_char_budget: 'agent',
|
|
agent_shell_enabled: 'agent',
|
|
data_dir: 'storage',
|
|
assets_dir: 'storage',
|
|
agent_workspace_dir: 'storage',
|
|
};
|
|
const dirtySections = $derived(new Set(dirtyKeys.map((k) => FIELD_SECTION[k]).filter(Boolean)));
|
|
|
|
// Mirrors backend Field(ge=..., le=...) limits — validated client-side so
|
|
// save never trips a raw 422.
|
|
const NUMERIC_LIMITS: Record<string, { min: number; max: number; labelKey: string }> = {
|
|
queue_concurrency: { min: 1, max: 8, labelKey: 'settings.concurrencyField' },
|
|
queue_poll_interval_sec: { min: 0.5, max: 60, labelKey: 'settings.pollIntervalField' },
|
|
queue_poll_timeout_sec: { min: 0, max: 86400, labelKey: 'settings.pollTimeoutField' },
|
|
queue_max_retries: { min: 0, max: 10, labelKey: 'settings.maxRetriesField' },
|
|
agent_max_steps: { min: 1, max: 100, labelKey: 'settings.agentMaxStepsField' },
|
|
agent_history_char_budget: { min: 10000, max: 2000000, labelKey: 'settings.historyBudgetField' },
|
|
};
|
|
|
|
function fieldError(key: string): string | null {
|
|
const limits = NUMERIC_LIMITS[key];
|
|
if (!limits) return null;
|
|
const raw = draft[key];
|
|
if (raw === undefined || raw === '' || raw === null) return null;
|
|
const v = Number(raw);
|
|
if (Number.isNaN(v)) return t('settings.notNumber', { label: t(limits.labelKey) });
|
|
if (v < limits.min) return t('settings.minError', { label: t(limits.labelKey), min: limits.min });
|
|
if (v > limits.max) return t('settings.maxError', { label: t(limits.labelKey), max: limits.max });
|
|
return null;
|
|
}
|
|
|
|
const validationErrors = $derived.by(() => {
|
|
const errors: Record<string, string> = {};
|
|
for (const key of Object.keys(NUMERIC_LIMITS)) {
|
|
const err = fieldError(key);
|
|
if (err) errors[key] = err;
|
|
}
|
|
return errors;
|
|
});
|
|
const isValid = $derived(Object.keys(validationErrors).length === 0);
|
|
|
|
function discardDraft() {
|
|
draft = {};
|
|
}
|
|
|
|
const saveMutation = createMutation({
|
|
mutationFn: () => {
|
|
const update: Record<string, unknown> = {};
|
|
for (const [k, v] of Object.entries(draft)) {
|
|
if (v === undefined) continue;
|
|
// dry_run / shell may be false; the hardening prompt may be emptied.
|
|
if (v === '' && k !== 'agent_hardening_prompt') continue;
|
|
if (typeof v === 'string' && k.endsWith('_dir')) {
|
|
// Strip wrapping quotes users often paste from Explorer
|
|
update[k] = v.trim().replace(/^["']|["']$/g, '');
|
|
continue;
|
|
}
|
|
update[k] = v;
|
|
}
|
|
return settings.update(update);
|
|
},
|
|
onSuccess: (saved) => {
|
|
client.invalidateQueries({ queryKey: ['settings'] });
|
|
discardDraft();
|
|
toast.success(saved?.dry_run ? t('settings.savedDryRun') : t('settings.saved'));
|
|
},
|
|
onError: (err) => {
|
|
// Surface pydantic 422 validation dumps as a readable message.
|
|
let msg = err instanceof Error ? err.message : t('settings.saveFailed');
|
|
const m = msg.match(/"msg":"([^"]+)"/);
|
|
if (m) {
|
|
const field = msg.match(/\["body","([a-z_]+)"\]/);
|
|
msg = field
|
|
? t('settings.invalidField', { field: field[1].replace(/_/g, ' '), detail: m[1] })
|
|
: t('settings.invalidValue', { detail: m[1] });
|
|
}
|
|
toast.error(msg);
|
|
},
|
|
});
|
|
|
|
// Leave-guard: in-app navigation away from /settings asks to discard;
|
|
// same-path section switches keep the draft. Tab close uses beforeunload.
|
|
let leaveOpen = $state(false);
|
|
let pendingUrl = $state<string | null>(null);
|
|
|
|
beforeNavigate((nav) => {
|
|
if (!isDirty || !nav.to) return;
|
|
if (nav.to.url.pathname === nav.from?.url.pathname) return;
|
|
nav.cancel();
|
|
pendingUrl = `${nav.to.url.pathname}${nav.to.url.search}${nav.to.url.hash}`;
|
|
leaveOpen = true;
|
|
});
|
|
|
|
function confirmLeave() {
|
|
const url = pendingUrl;
|
|
pendingUrl = null;
|
|
discardDraft();
|
|
if (url) goto(url);
|
|
}
|
|
|
|
function onBeforeUnload(e: BeforeUnloadEvent) {
|
|
if (!isDirty) return;
|
|
e.preventDefault();
|
|
e.returnValue = '';
|
|
}
|
|
|
|
function fieldValue(key: keyof Settings, fallback: string | number | boolean | null | undefined) {
|
|
if (draft[key] !== undefined && draft[key] !== '') return draft[key] as string;
|
|
const raw = fallback ?? '';
|
|
if (typeof raw === 'string') return raw.replace(/^["']|["']$/g, '');
|
|
return raw;
|
|
}
|
|
|
|
function boolValue(s: Settings, key: 'dry_run' | 'agent_shell_enabled'): boolean {
|
|
if (draft[key] !== undefined) return Boolean(draft[key]);
|
|
return s[key] === true;
|
|
}
|
|
|
|
// History budget presets (chars). Large matches the backend default (400k).
|
|
const HISTORY_BUDGET_PRESETS: { value: number; labelKey: string }[] = [
|
|
{ value: 60_000, labelKey: 'settings.historyBudgetSmall' },
|
|
{ value: 120_000, labelKey: 'settings.historyBudgetMedium' },
|
|
{ value: 400_000, labelKey: 'settings.historyBudgetLarge' },
|
|
];
|
|
|
|
function historyBudgetActive(s: Settings, value: number): boolean {
|
|
const current =
|
|
draft.agent_history_char_budget !== undefined
|
|
? Number(draft.agent_history_char_budget)
|
|
: Number(s.agent_history_char_budget ?? 0);
|
|
return current === value;
|
|
}
|
|
|
|
// Snap out-of-range numbers back into the valid range when the user leaves
|
|
// the field, so a typed 200 never reaches the backend.
|
|
function clampOnBlur(e: FocusEvent, key: string) {
|
|
const limits = NUMERIC_LIMITS[key];
|
|
if (!limits) return;
|
|
const el = e.currentTarget as HTMLInputElement;
|
|
const v = Number(el.value);
|
|
if (el.value === '' || Number.isNaN(v)) return;
|
|
const clamped = Math.min(Math.max(v, limits.min), limits.max);
|
|
if (clamped !== v) {
|
|
el.value = String(clamped);
|
|
draft[key] = clamped;
|
|
}
|
|
}
|
|
|
|
// The hardening prompt may be intentionally emptied, so it can't reuse
|
|
// fieldValue (which falls back to the saved value on '').
|
|
function hardeningDraft(s: Settings): string {
|
|
if (draft.agent_hardening_prompt !== undefined) return String(draft.agent_hardening_prompt);
|
|
return s.agent_hardening_prompt ?? '';
|
|
}
|
|
|
|
function selectSection(id: Section) {
|
|
goto(`/settings?tab=${id}`, { replaceState: true, noScroll: true, keepFocus: true });
|
|
}
|
|
|
|
type NumField = {
|
|
key: keyof Settings & string;
|
|
labelKey: string;
|
|
hintKey?: string;
|
|
step: string;
|
|
};
|
|
const QUEUE_FIELDS: NumField[] = [
|
|
{ key: 'queue_concurrency', labelKey: 'settings.concurrencyField', step: '1' },
|
|
{ key: 'queue_max_retries', labelKey: 'settings.maxRetriesField', step: '1' },
|
|
{ key: 'queue_poll_interval_sec', labelKey: 'settings.pollIntervalField', step: '0.5' },
|
|
{
|
|
key: 'queue_poll_timeout_sec',
|
|
labelKey: 'settings.pollTimeoutField',
|
|
hintKey: 'settings.pollTimeoutHint',
|
|
step: '1',
|
|
},
|
|
];
|
|
</script>
|
|
|
|
<svelte:window onbeforeunload={onBeforeUnload} />
|
|
|
|
{#snippet numberField(s: Settings, f: NumField)}
|
|
{@const limits = NUMERIC_LIMITS[f.key]}
|
|
<label class="field">
|
|
<span class="field-label">{t(f.labelKey)}</span>
|
|
<input
|
|
class="a-input mono"
|
|
class:invalid={validationErrors[f.key]}
|
|
type="number"
|
|
min={limits.min}
|
|
max={limits.max}
|
|
step={f.step}
|
|
value={String(fieldValue(f.key, s[f.key] as number))}
|
|
oninput={(e) => (draft[f.key] = e.currentTarget.value)}
|
|
onblur={(e) => clampOnBlur(e, f.key)}
|
|
/>
|
|
{#if validationErrors[f.key]}
|
|
<p class="field-error">{validationErrors[f.key]}</p>
|
|
{:else}
|
|
<p class="field-hint">
|
|
{t('settings.rangeHint', { min: limits.min, max: limits.max })}{#if f.hintKey}
|
|
· {t(f.hintKey)}{/if}
|
|
</p>
|
|
{/if}
|
|
</label>
|
|
{/snippet}
|
|
|
|
<AppShell active="settings" title={t('shell.navSettings')} subtitle={t('settings.pageSub')}>
|
|
{#snippet actions()}
|
|
<span class="status-chip" class:accent={isDirty}>
|
|
{#if isDirty}<span class="status-chip-dot" aria-hidden="true"></span>{/if}
|
|
{isDirty ? t('settings.unsaved') : t('settings.allSaved')}
|
|
</span>
|
|
<Button variant="ghost" disabled={!isDirty || $saveMutation.isPending} onclick={discardDraft}>
|
|
{t('settings.discard')}
|
|
</Button>
|
|
<Button
|
|
variant="primary"
|
|
disabled={!isDirty || !isValid}
|
|
loading={$saveMutation.isPending}
|
|
onclick={() => $saveMutation.mutate()}
|
|
>
|
|
{t('settings.saveChanges')}
|
|
</Button>
|
|
{/snippet}
|
|
|
|
<div class="page">
|
|
<nav class="sections" aria-label={t('shell.navSettings')}>
|
|
{#each SECTIONS as sec (sec.id)}
|
|
<button
|
|
type="button"
|
|
class="sec"
|
|
class:active={tab === sec.id}
|
|
aria-current={tab === sec.id ? 'page' : undefined}
|
|
onclick={() => selectSection(sec.id)}
|
|
>
|
|
<span class="sec-icon"><Icon name={sec.icon} size={15} /></span>
|
|
<span class="sec-copy">
|
|
<span class="sec-label">
|
|
{t(sec.labelKey)}
|
|
{#if dirtySections.has(sec.id)}
|
|
<span class="dirty-dot" title={t('settings.unsaved')}></span>
|
|
{/if}
|
|
</span>
|
|
<span class="sec-blurb">{t(sec.blurbKey)}</span>
|
|
</span>
|
|
</button>
|
|
{/each}
|
|
|
|
<p class="elsewhere-head">{t('settings.elsewhere')}</p>
|
|
{#each ELSEWHERE as link (link.href)}
|
|
<a class="sec link" href={link.href}>
|
|
<span class="sec-icon"><Icon name={link.icon} size={15} /></span>
|
|
<span class="sec-copy">
|
|
<span class="sec-label">{t(link.labelKey)}</span>
|
|
<span class="sec-blurb">{t(link.blurbKey)}</span>
|
|
</span>
|
|
<span class="sec-arrow" aria-hidden="true">→</span>
|
|
</a>
|
|
{/each}
|
|
</nav>
|
|
|
|
<div class="content">
|
|
{#if $settingsQuery.isLoading}
|
|
<p class="muted">{t('settings.loading')}</p>
|
|
{:else if $settingsQuery.isError}
|
|
<div class="a-panel error-panel" role="alert">
|
|
<Icon name="alert" size={16} />
|
|
<p>{t('settings.loadFailed')}</p>
|
|
<Button size="sm" onclick={() => $settingsQuery.refetch()}>{t('common.retry')}</Button>
|
|
</div>
|
|
{:else if $settingsQuery.data}
|
|
{@const s = $settingsQuery.data}
|
|
{#if tab === 'queue'}
|
|
<section class="a-panel">
|
|
<header class="panel-head">
|
|
<h2 class="a-panel-title">{t('settings.queueSection')}</h2>
|
|
<p class="a-panel-lead">{t('settings.queueLead')}</p>
|
|
</header>
|
|
<div class="grid-2">
|
|
{#each QUEUE_FIELDS as f (f.key)}
|
|
{@render numberField(s, f)}
|
|
{/each}
|
|
</div>
|
|
</section>
|
|
|
|
<section class="a-panel">
|
|
<div class="switch-row">
|
|
<div class="switch-copy">
|
|
<h2 class="a-panel-title">{t('settings.dryRunTitle')}</h2>
|
|
<p class="a-panel-lead">{t('settings.dryRunHint')}</p>
|
|
</div>
|
|
<Switch
|
|
checked={boolValue(s, 'dry_run')}
|
|
label={t('settings.dryRunLabel')}
|
|
onchange={(next) => (draft.dry_run = next)}
|
|
/>
|
|
</div>
|
|
</section>
|
|
{:else if tab === 'agent'}
|
|
<section class="a-panel">
|
|
<header class="panel-head">
|
|
<h2 class="a-panel-title">{t('settings.agentRunSection')}</h2>
|
|
<p class="a-panel-lead">{t('settings.agentRunLead')}</p>
|
|
</header>
|
|
<div class="grid-2">
|
|
{@render numberField(s, {
|
|
key: 'agent_max_steps',
|
|
labelKey: 'settings.agentMaxStepsField',
|
|
hintKey: 'settings.agentMaxStepsHint',
|
|
step: '1',
|
|
})}
|
|
<div class="budget">
|
|
{@render numberField(s, {
|
|
key: 'agent_history_char_budget',
|
|
labelKey: 'settings.historyBudgetField',
|
|
step: '1000',
|
|
})}
|
|
<div class="presets">
|
|
{#each HISTORY_BUDGET_PRESETS as preset (preset.value)}
|
|
<button
|
|
type="button"
|
|
class="preset"
|
|
class:active={historyBudgetActive(s, preset.value)}
|
|
onclick={() => (draft.agent_history_char_budget = String(preset.value))}
|
|
>
|
|
{t(preset.labelKey)}
|
|
</button>
|
|
{/each}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<p class="field-hint">{t('settings.historyBudgetHint')}</p>
|
|
</section>
|
|
|
|
<section class="a-panel">
|
|
<header class="panel-head">
|
|
<h2 class="a-panel-title">{t('settings.hardeningSection')}</h2>
|
|
<p class="a-panel-lead">
|
|
{t('settings.hardeningLead')}
|
|
{t('settings.hardeningCalloutStrong')}{t('settings.hardeningCalloutBody')}
|
|
</p>
|
|
</header>
|
|
<label class="field">
|
|
<span class="field-label">{t('settings.hardeningRulesLabel')}</span>
|
|
<textarea
|
|
class="a-textarea mono"
|
|
rows={10}
|
|
spellcheck="false"
|
|
value={hardeningDraft(s)}
|
|
oninput={(e) => (draft.agent_hardening_prompt = e.currentTarget.value)}
|
|
placeholder={t('settings.hardeningPlaceholder')}
|
|
></textarea>
|
|
<p class="field-hint">{t('settings.hardeningHint')}</p>
|
|
</label>
|
|
</section>
|
|
|
|
<section class="a-panel">
|
|
<div class="switch-row">
|
|
<div class="switch-copy">
|
|
<h2 class="a-panel-title">{t('settings.shellSection')}</h2>
|
|
<p class="a-panel-lead">{t('settings.shellLead')}</p>
|
|
</div>
|
|
<Switch
|
|
checked={boolValue(s, 'agent_shell_enabled')}
|
|
label={t('settings.shellLabel')}
|
|
onchange={(next) => (draft.agent_shell_enabled = next)}
|
|
/>
|
|
</div>
|
|
<div class="note warn">
|
|
<Icon name="alert" size={14} />
|
|
<p>
|
|
<strong>{t('settings.shellCalloutStrong')}</strong>
|
|
{t('settings.shellCalloutBody')}
|
|
</p>
|
|
</div>
|
|
<p class="field-hint">{t('settings.shellHint')}</p>
|
|
</section>
|
|
|
|
<MemoryPanel />
|
|
{:else if tab === 'storage'}
|
|
<section class="a-panel">
|
|
<header class="panel-head">
|
|
<h2 class="a-panel-title">{t('settings.storageSection')}</h2>
|
|
<p class="a-panel-lead">{t('settings.storageLead')}</p>
|
|
</header>
|
|
<div class="note warn">
|
|
<Icon name="alert" size={14} />
|
|
<p>
|
|
<strong>{t('settings.storageCalloutStrong')}</strong>
|
|
{t('settings.storageCalloutBody')}
|
|
</p>
|
|
</div>
|
|
<label class="field">
|
|
<span class="field-label">{t('settings.dataDir')}</span>
|
|
<input
|
|
class="a-input mono"
|
|
value={String(fieldValue('data_dir', s.data_dir))}
|
|
oninput={(e) => (draft.data_dir = e.currentTarget.value)}
|
|
/>
|
|
<p class="field-hint">{t('settings.current')} <code>{s.data_dir}</code></p>
|
|
</label>
|
|
<label class="field">
|
|
<span class="field-label">{t('settings.assetsDir')}</span>
|
|
<input
|
|
class="a-input mono"
|
|
value={String(fieldValue('assets_dir', s.assets_dir))}
|
|
oninput={(e) => (draft.assets_dir = e.currentTarget.value)}
|
|
/>
|
|
<p class="field-hint">{t('settings.current')} <code>{s.assets_dir}</code></p>
|
|
</label>
|
|
<label class="field">
|
|
<span class="field-label">{t('settings.workspaceDir')}</span>
|
|
<input
|
|
class="a-input mono"
|
|
value={String(fieldValue('agent_workspace_dir', s.agent_workspace_dir))}
|
|
oninput={(e) => (draft.agent_workspace_dir = e.currentTarget.value)}
|
|
/>
|
|
<p class="field-hint">{t('settings.workspaceDirHint')}</p>
|
|
<p class="field-hint">{t('settings.current')} <code>{s.agent_workspace_dir}</code></p>
|
|
</label>
|
|
</section>
|
|
{/if}
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
</AppShell>
|
|
|
|
<ConfirmDialog
|
|
bind:open={leaveOpen}
|
|
title={t('settings.leaveTitle')}
|
|
message={t('settings.leaveMessage')}
|
|
confirmLabel={t('settings.leaveConfirm')}
|
|
danger
|
|
onconfirm={confirmLeave}
|
|
oncancel={() => (pendingUrl = null)}
|
|
/>
|
|
|
|
<style>
|
|
.page {
|
|
display: flex;
|
|
gap: 24px;
|
|
padding: 24px 28px 40px;
|
|
align-items: flex-start;
|
|
}
|
|
|
|
/* ---------------- section list ---------------- */
|
|
.sections {
|
|
width: 248px;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
padding: 10px;
|
|
background: var(--surface);
|
|
border: 1px solid var(--border);
|
|
border-radius: 10px;
|
|
box-sizing: border-box;
|
|
position: sticky;
|
|
top: 0;
|
|
}
|
|
.sec {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 10px;
|
|
width: 100%;
|
|
padding: 9px 10px;
|
|
border: none;
|
|
border-radius: 8px;
|
|
background: transparent;
|
|
color: var(--text-2);
|
|
font-family: inherit;
|
|
text-align: left;
|
|
text-decoration: none;
|
|
cursor: pointer;
|
|
transition:
|
|
background-color 150ms cubic-bezier(0.16, 1, 0.3, 1),
|
|
color 150ms;
|
|
}
|
|
.sec:hover {
|
|
background: var(--surface-3);
|
|
color: var(--text);
|
|
}
|
|
.sec.active {
|
|
background: var(--surface-3);
|
|
color: var(--text);
|
|
}
|
|
.sec-icon {
|
|
display: inline-flex;
|
|
margin-top: 2px;
|
|
flex-shrink: 0;
|
|
}
|
|
.sec.active .sec-icon {
|
|
color: var(--accent);
|
|
}
|
|
.sec-copy {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2px;
|
|
min-width: 0;
|
|
flex: 1;
|
|
}
|
|
.sec-label {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
}
|
|
.sec-blurb {
|
|
font-size: 11px;
|
|
line-height: 1.5;
|
|
color: var(--text-3);
|
|
}
|
|
.sec-arrow {
|
|
color: var(--text-3);
|
|
font-size: 12px;
|
|
margin-top: 1px;
|
|
}
|
|
.dirty-dot {
|
|
width: 6px;
|
|
height: 6px;
|
|
border-radius: 50%;
|
|
background: var(--accent);
|
|
}
|
|
.elsewhere-head {
|
|
margin: 12px 10px 4px;
|
|
padding-top: 12px;
|
|
border-top: 1px solid var(--border);
|
|
font-size: 11px;
|
|
color: var(--text-3);
|
|
}
|
|
|
|
/* ---------------- content ---------------- */
|
|
.content {
|
|
flex: 1;
|
|
min-width: 0;
|
|
max-width: 820px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
}
|
|
.panel-head {
|
|
margin-bottom: 16px;
|
|
}
|
|
.grid-2 {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
gap: 0 16px;
|
|
}
|
|
.budget .presets {
|
|
margin: -6px 0 14px;
|
|
}
|
|
.switch-row {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
justify-content: space-between;
|
|
gap: 20px;
|
|
}
|
|
.presets {
|
|
display: flex;
|
|
gap: 6px;
|
|
flex-wrap: wrap;
|
|
}
|
|
/* §4.3 分段 chip: selected = amber outline + amber text + dim fill */
|
|
.preset {
|
|
padding: 3px 11px;
|
|
border-radius: 999px;
|
|
border: 1px solid var(--border-strong);
|
|
background: transparent;
|
|
color: var(--text-2);
|
|
font-family: inherit;
|
|
font-size: 11.5px;
|
|
cursor: pointer;
|
|
transition:
|
|
border-color 150ms,
|
|
color 150ms,
|
|
background-color 150ms;
|
|
}
|
|
.preset:hover {
|
|
border-color: var(--border-hover);
|
|
color: var(--text);
|
|
}
|
|
.preset.active {
|
|
border-color: var(--accent);
|
|
background: var(--accent-dim);
|
|
color: var(--accent);
|
|
}
|
|
.note {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 8px;
|
|
margin: 14px 0;
|
|
padding: 10px 12px;
|
|
border-radius: 8px;
|
|
border: 1px dashed var(--border-strong);
|
|
color: var(--text-2);
|
|
}
|
|
.note.warn :global(.icon) {
|
|
color: var(--accent);
|
|
flex-shrink: 0;
|
|
margin-top: 2px;
|
|
}
|
|
.note p {
|
|
margin: 0;
|
|
font-size: 12px;
|
|
line-height: 1.6;
|
|
}
|
|
.note strong {
|
|
color: var(--text);
|
|
}
|
|
.field-hint code {
|
|
color: var(--text-2);
|
|
word-break: break-all;
|
|
}
|
|
.muted {
|
|
color: var(--text-3);
|
|
}
|
|
.error-panel {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
color: var(--error);
|
|
}
|
|
.error-panel p {
|
|
margin: 0;
|
|
flex: 1;
|
|
font-size: 12.5px;
|
|
}
|
|
|
|
/* ---------------- responsive (§4.5) ---------------- */
|
|
@media (max-width: 1023px) {
|
|
.page {
|
|
flex-direction: column;
|
|
padding: 18px;
|
|
}
|
|
.sections {
|
|
width: 100%;
|
|
position: static;
|
|
flex-direction: row;
|
|
flex-wrap: wrap;
|
|
}
|
|
.sec {
|
|
width: auto;
|
|
flex: 1 1 200px;
|
|
}
|
|
.elsewhere-head {
|
|
flex-basis: 100%;
|
|
margin: 6px 10px 0;
|
|
padding-top: 8px;
|
|
}
|
|
.content {
|
|
max-width: none;
|
|
width: 100%;
|
|
}
|
|
.grid-2 {
|
|
grid-template-columns: minmax(0, 1fr);
|
|
}
|
|
}
|
|
</style>
|