Files
aigc-home/calliope-web/src/lib/components/WorkflowImportDrawer.svelte
T
总工andmultica-agent 6064bd805d feat(ui): E批——工作流导入与试运行右侧抽屉 + 四步检查 (HEL-655)
- 新增 ui/Drawer.svelte 右侧抽屉基元:380/420px、--d-drawer 280ms
  --ease-drawer 可反向、Esc/Tab 焦点圈、遮罩点击关闭、减动效仅留 ≤120ms 淡变
- 新增 WorkflowImportDrawer.svelte:导入两步向导抽屉化,四步检查
  (解析 JSON→识别节点→核对模型→建立输入槽)逐条出现(80ms 错峰)、
  ✓绿/…青/✕红/待确认琥珀 + 中文原因 + 下一步建议 + 可展开错误 + 重新检查 +
  「查看原始 JSON」折叠;沿用 /api/workflows/analyze 原判定与保存边界
- WorkflowTestDialog.svelte 居中弹窗改右侧抽屉:运行中青芯片 + 进度条 +
  mono 阶段日志滚动区,结果缩略图横排、失败红 + 长错误可展开;
  逻辑(确认弹层、dry_run 拒绝、产物隔离、重复提交复用)不变
- connections 页:导入入口统一为抽屉按钮,次级文字操作(测试/重新检查/更改)
  改 ghost(HEL-649 v2 §1.2),连接卡片改 §3.7 网格;移除内联导入块与死样式
- i18n 七语种各 +16 键(wfd.*)计数一致
- e2e:fake_comfy.py 支持 object_info/no_outputs 场景;新增 import.mjs
  43 项浏览器回归全过;D 批 shoot.mjs 54/54 复跑通过

Co-authored-by: multica-agent <github@multica.ai>
2026-09-30 14:42:56 +08:00

1130 lines
30 KiB
Svelte
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script lang="ts">
import { createMutation, useQueryClient } from '@tanstack/svelte-query';
import {
apiErrorMessage,
workflows,
type ComfyEndpoint,
type Workflow,
type WorkflowOutputMapEntry,
type WorkflowUsage,
type WorkflowAnalyzeResult,
} from '$lib/api';
import { WORKFLOW_USAGES } from '$lib/comfy/types';
import Button from '$lib/components/ui/Button.svelte';
import Drawer from '$lib/components/ui/Drawer.svelte';
import Icon from '$lib/components/ui/Icon.svelte';
import { toast } from '$lib/toast';
import { t } from '$lib/i18n.svelte';
/**
* Workflow import drawer (HEL-655 E 批): the two-step import wizard
* (paste → analyze → confirm) in a right-side drawer with the four-step
* checklist 解析 JSON → 识别节点 → 核对模型 → 建立输入槽 (HEL-649 §3.8).
* Analysis, confirmation, output mapping and saving all ride the already
* shipped /api/workflows/analyze + create endpoints — nothing re-judges.
*/
interface Props {
open?: boolean;
endpoints: ComfyEndpoint[];
onchanged?: () => void;
}
let { open = $bindable(false), endpoints, onchanged }: Props = $props();
const client = useQueryClient();
let wfJsonText = $state('');
let wfImportName = $state('');
let wfImportEndpoint = $state('');
let wfStep = $state<'input' | 'confirm'>('input');
let wfAnalysis = $state<WorkflowAnalyzeResult | null>(null);
let wfUsage = $state<WorkflowUsage | null>(null);
let wfRoleOverrides = $state<Record<string, string>>({});
// HEL-638: explicit output-node designation for unknown custom nodes.
let wfOutputPicked = $state<Record<string, boolean>>({});
let wfOutputKind = $state<Record<string, 'image' | 'video'>>({});
let wfAnalyzing = $state(false);
let wfAnalyzeError = $state('');
let showRawJson = $state(false);
let findingsOpen = $state(true);
let analysisRun = $state(0);
const wfParsed = $derived.by(() => {
const text = wfJsonText.trim();
if (!text)
return {
valid: false as const,
json: null as Record<string, unknown> | null,
};
try {
const parsed = JSON.parse(text) as unknown;
if (
typeof parsed === 'object' &&
parsed !== null &&
!Array.isArray(parsed) &&
Object.values(parsed).some(
(v) =>
typeof v === 'object' &&
v !== null &&
'class_type' in (v as object),
)
) {
return {
valid: true as const,
json: parsed as Record<string, unknown>,
};
}
} catch {
/* fallthrough */
}
return { valid: false as const, json: null };
});
function usageLabel(u: WorkflowUsage | null | undefined): string {
return u ? t(`usage.${u}`) : t('usage.pending');
}
function resetImport() {
wfJsonText = '';
wfImportName = '';
wfImportEndpoint = '';
wfStep = 'input';
wfAnalysis = null;
wfUsage = null;
wfRoleOverrides = {};
wfOutputPicked = {};
wfOutputKind = {};
wfAnalyzeError = '';
showRawJson = false;
findingsOpen = true;
}
$effect(() => {
if (open) resetImport();
});
async function runWfAnalyze(refresh = false) {
if (!wfParsed.valid || !wfParsed.json) return;
wfAnalyzing = true;
wfAnalyzeError = '';
try {
const res = await workflows.analyze(
wfParsed.json,
wfImportEndpoint || undefined,
refresh,
);
wfAnalysis = res;
wfUsage = res.usage ?? null;
wfRoleOverrides = {};
// Unknown output candidates: preselect only when there is exactly
// one — with several the user must decide (HEL-638).
const candidates = (res.usage_evidence.outputs ?? []).filter(
(o) => o.evidence === 'unknown_node',
);
const picked: Record<string, boolean> = {};
const kinds: Record<string, 'image' | 'video'> = {};
for (const c of candidates) {
kinds[c.nodeId] = c.suggested_kind ?? 'image';
}
if (candidates.length === 1) picked[candidates[0].nodeId] = true;
wfOutputPicked = picked;
wfOutputKind = kinds;
findingsOpen = true;
analysisRun += 1;
wfStep = 'confirm';
} catch (err) {
wfAnalyzeError = apiErrorMessage(err);
} finally {
wfAnalyzing = false;
}
}
/** True when the graph has no output node at all — nothing to confirm. */
const wfFatal = $derived(
wfStep === 'confirm' &&
wfAnalysis !== null &&
(wfAnalysis.outputs?.length ?? 0) === 0,
);
/** Unknown custom output nodes the user must designate (HEL-638). */
const wfOutputCandidates = $derived(
wfStep === 'confirm' && wfAnalysis !== null
? (wfAnalysis.usage_evidence.outputs ?? []).filter(
(o) => o.evidence === 'unknown_node',
)
: [],
);
const wfOutputRows = $derived(
wfOutputCandidates.map((o) => ({
...o,
picked: wfOutputPicked[o.nodeId] ?? false,
kind: wfOutputKind[o.nodeId] ?? o.suggested_kind ?? 'image',
})),
);
const wfOutputPickedCount = $derived(
Object.values(wfOutputPicked).filter(Boolean).length,
);
const wfSaveable = $derived(
wfStep === 'confirm' &&
wfUsage !== null &&
!wfFatal &&
(wfOutputCandidates.length === 0 || wfOutputPickedCount > 0),
);
/** Media slots the confirm page lets the user re-role. */
const wfSlotRows = $derived.by(() => {
if (wfStep !== 'confirm' || !wfAnalysis) return [];
return wfAnalysis.usage_evidence.image_slots.map((s) => ({
...s,
role: wfRoleOverrides[s.nodeId] ?? s.role ?? 'image',
fixed: s.kind === 'image_list',
}));
});
const wfParamPreview = $derived(
wfAnalysis ? wfAnalysis.inputs.map((i) => i.label) : [],
);
const wfImportMutation = createMutation({
mutationFn: async () => {
if (!wfParsed.valid || !wfParsed.json || !wfAnalysis || !wfUsage)
throw new Error(t('conn.wfPickUsage'));
if (wfOutputCandidates.length > 0 && wfOutputPickedCount === 0)
throw new Error(t('conn.wfOutputPick'));
const corrected = Object.keys(wfRoleOverrides).length > 0;
const schema = wfAnalysis.inputs.map((e) =>
wfRoleOverrides[e.nodeId]
? { ...e, role: wfRoleOverrides[e.nodeId], manual: true }
: e,
);
const outputMap: WorkflowOutputMapEntry[] = wfOutputRows
.filter((r) => r.picked)
.map((r) => ({
nodeId: r.nodeId,
kind: r.kind,
label: r.label,
...(r.class_type ? { class_type: r.class_type } : {}),
}));
return workflows.create({
name: wfImportName.trim(),
workflow_json: wfParsed.json,
usage: wfUsage,
usage_source:
wfUsage !== wfAnalysis.usage || corrected ? 'user' : 'auto',
input_schema: schema,
...(outputMap.length
? { output_map: outputMap, output_map_source: 'user' }
: {}),
...(wfImportEndpoint ? { endpoint_id: wfImportEndpoint } : {}),
});
},
onSuccess: (wf: Workflow) => {
client.invalidateQueries({ queryKey: ['workflows'] });
const n = wf.input_schema?.length ?? 0;
const problems = (wf.warnings ?? [])
.filter((w) => w.level === 'error')
.map((w) => w.message);
if (problems.length)
toast.error(
t('conn.wfImportedBroken', { detail: problems.join(';') }),
);
else if (n)
toast.success(
t('conn.wfImportedWithUsage', { usage: usageLabel(wf.usage), n }),
);
else toast.info(t('conn.wfImportedNoParams'));
onchanged?.();
open = false;
},
onError: (err) => {
toast.error(
t('conn.wfImportFailed', {
detail: err instanceof Error ? err.message : String(err),
}),
);
},
});
function submitWfImport() {
if (!wfSaveable || !wfImportName.trim() || $wfImportMutation.isPending)
return;
$wfImportMutation.mutate();
}
async function onWfFile(e: Event) {
const input = e.currentTarget as HTMLInputElement;
const file = input.files?.[0];
if (!file) return;
wfJsonText = await file.text();
if (!wfImportName.trim()) wfImportName = file.name.replace(/\.json$/i, '');
input.value = '';
}
// ------------------------------------------------------------------
// Four-step checklist (HEL-649 §3.8) — pure presentation over the
// existing analysis state; rows are revealed one by one, 80ms apart.
// ------------------------------------------------------------------
type StepState = 'idle' | 'run' | 'ok' | 'warn' | 'fail';
interface CheckStep {
key: 'parse' | 'nodes' | 'models' | 'slots';
label: string;
state: StepState;
line: string;
}
const connCheck = $derived(wfAnalysis?.connection_check ?? null);
const checkSteps = $derived.by<CheckStep[]>(() => {
if (wfStep !== 'confirm' || !wfAnalysis) return [];
const steps: CheckStep[] = [];
// ① 解析 JSON
steps.push({
key: 'parse',
label: t('wfd.stepParse'),
state: 'ok',
line: t('conn.wfNodes', { n: Object.keys(wfParsed.json ?? {}).length }),
});
// ② 识别节点(用途判定)
if (wfFatal) {
steps.push({
key: 'nodes',
label: t('wfd.stepNodes'),
state: 'fail',
line: wfAnalysis.usage_problem ?? t('wfd.noOutput'),
});
} else if (
wfUsage &&
(wfOutputCandidates.length === 0 || wfOutputPickedCount > 0)
) {
steps.push({
key: 'nodes',
label: t('wfd.stepNodes'),
state: 'ok',
line:
wfUsage === wfAnalysis.usage
? t('wfd.nodesAutoOk', { usage: usageLabel(wfUsage) })
: t('wfd.nodesUserOk', { usage: usageLabel(wfUsage) }),
});
} else {
steps.push({
key: 'nodes',
label: t('wfd.stepNodes'),
state: 'warn',
line:
(wfAnalysis.usage_problem ? wfAnalysis.usage_problem + ';' : '') +
(wfOutputCandidates.length && wfOutputPickedCount === 0
? t('conn.wfOutputPick')
: t('conn.wfUsageNeedPick')),
});
}
// ③ 核对模型(L2 连接比对)
if (!connCheck || connCheck.reachable !== true) {
steps.push({
key: 'models',
label: t('wfd.stepModels'),
state: 'warn',
line: connCheck?.message ?? t('conn.wfCheckUnreachable'),
});
} else if (connCheck.ok) {
steps.push({
key: 'models',
label: t('wfd.stepModels'),
state: 'ok',
line: t('wfd.modelsOk', {
name: connCheck.endpoint_name ?? t('conn.wfConnectionActive'),
}),
});
} else {
steps.push({
key: 'models',
label: t('wfd.stepModels'),
state: 'fail',
line: t('conn.wfCheckProblems', { n: connCheck.findings.length }),
});
}
// ④ 建立输入槽
const mediaSlots = wfAnalysis.inputs.filter((i) =>
[
'image_list',
'video_list',
'audio_list',
'image',
'video',
'audio',
].includes(i.kind),
);
if (wfFatal) {
steps.push({
key: 'slots',
label: t('wfd.stepSlots'),
state: 'fail',
line: t('wfd.noOutput'),
});
} else {
steps.push({
key: 'slots',
label: t('wfd.stepSlots'),
state: 'ok',
line: t('wfd.slotsOk', {
n: wfAnalysis.inputs.length,
m: mediaSlots.length,
}),
});
}
return steps;
});
// Reveal the checklist one row per 80ms when a fresh analysis lands;
// reduced motion shows everything at once.
let stepsShown = $state(0);
function reducedMotion(): boolean {
return (
typeof document !== 'undefined' &&
(document.documentElement.dataset.reduce === '1' ||
window.matchMedia('(prefers-reduced-motion: reduce)').matches)
);
}
$effect(() => {
const run = analysisRun;
if (!run) {
stepsShown = 0;
return;
}
if (reducedMotion()) {
stepsShown = 4;
return;
}
stepsShown = 0;
const timers = [0, 1, 2, 3].map((i) =>
setTimeout(() => (stepsShown = i + 1), i * 80),
);
return () => timers.forEach(clearTimeout);
});
</script>
<Drawer bind:open title={t('conn.wfImportTitle')} width={380}>
{#if wfStep === 'input'}
<p class="hint">{t('conn.wfImportHint')}</p>
<label class="field">
<span class="field-label">{t('conn.fName')}<em class="req">*</em></span>
<input
class="a-input"
value={wfImportName}
oninput={(e) => (wfImportName = e.currentTarget.value)}
placeholder="Qwen Image 2.1 文生图"
/>
</label>
<label class="field">
<span class="field-label">{t('conn.wfConnection')}</span>
<select
class="a-select full"
value={wfImportEndpoint}
onchange={(e) => (wfImportEndpoint = e.currentTarget.value)}
>
<option value="">{t('conn.wfConnectionActive')}</option>
{#each endpoints as ep (ep.id)}
<option value={ep.id}>{ep.name}</option>
{/each}
</select>
</label>
<div class="field">
<span class="field-label">API JSON<em class="req">*</em></span>
<textarea
class="a-textarea json"
class:invalid={wfJsonText.trim() !== '' && !wfParsed.valid}
spellcheck="false"
value={wfJsonText}
oninput={(e) => (wfJsonText = e.currentTarget.value)}
placeholder={t('conn.wfJsonPh')}
></textarea>
<div class="file-row">
<label class="file-btn">
<Icon name="upload" size={14} />
{t('conn.wfChooseFile')}
<input
type="file"
accept=".json,application/json"
onchange={onWfFile}
/>
</label>
<span class="need-test" class:passed={wfParsed.valid}>
{wfParsed.valid
? t('conn.wfNodes', { n: Object.keys(wfParsed.json ?? {}).length })
: 'JSON'}
</span>
</div>
{#if wfJsonText.trim() !== '' && !wfParsed.valid}
<span class="field-error">{t('conn.wfJsonInvalid')}</span>
{/if}
</div>
<div class="actions">
<Button
variant="primary"
size="sm"
disabled={!wfParsed.valid || !wfImportName.trim()}
loading={wfAnalyzing}
onclick={() => runWfAnalyze()}
>
{wfAnalyzing ? t('conn.wfAnalyzing') : t('conn.wfAnalyze')}
</Button>
</div>
{:else if wfAnalysis}
<p class="hint">{t('conn.wfConfirmHint')}</p>
{#if wfAnalyzeError}
<div class="note fatal" role="alert">
<Icon name="alert" size={14} />
<p>{wfAnalyzeError}</p>
</div>
{/if}
<ol class="checks" aria-label={t('wfd.checksAria')}>
{#each checkSteps as step, i (step.key)}
{#if i < stepsShown}
<li class="check state-{step.state}">
<span class="mark" aria-hidden="true">
{#if step.state === 'ok'}
<Icon name="check" size={12} />
{:else if step.state === 'fail'}
<Icon name="close" size={12} />
{:else}
<Icon name="alert" size={12} />
{/if}
</span>
<span class="check-text">
<span class="check-label">{step.label}</span>
<span class="check-line">{step.line}</span>
{#if step.key === 'models' && connCheck && connCheck.reachable === true && !connCheck.ok}
<button
type="button"
class="check-toggle"
aria-expanded={findingsOpen}
onclick={() => (findingsOpen = !findingsOpen)}
>
{findingsOpen ? t('wfd.hideDetails') : t('wfd.showDetails')}
</button>
{#if findingsOpen}
<ul class="findings">
{#each connCheck.findings as f (f.node_id + f.code)}
<li>
<span class="finding-msg">{f.message}</span>
{#if f.hint}<span class="finding-hint">{f.hint}</span
>{/if}
</li>
{/each}
</ul>
{/if}
<p class="suggest">{t('conn.wfCheckSaveHint')}</p>
{:else if step.key === 'models' && step.state === 'warn'}
<p class="suggest">{t('wfd.unreachableSuggest')}</p>
{:else if step.key === 'nodes' && step.state === 'warn'}
<p class="suggest">{t('wfd.nodesPickSuggest')}</p>
{/if}
</span>
{#if step.key === 'models'}
<button
type="button"
class="recheck"
disabled={wfAnalyzing}
onclick={() => runWfAnalyze(true)}
>
{wfAnalyzing ? t('conn.wfChecking') : t('conn.wfCheckBtn')}
</button>
{/if}
</li>
{/if}
{/each}
</ol>
{#if wfAnalysis.usage_problem}
<div class="note" class:fatal={wfFatal} role={wfFatal ? 'alert' : 'note'}>
<Icon name={wfFatal ? 'alert' : 'info'} size={14} />
<p>{wfAnalysis.usage_problem}</p>
</div>
{/if}
<ul class="evidence">
{#each wfAnalysis.usage_evidence.summary as line (line)}
<li>{line}</li>
{/each}
</ul>
<div class="field">
<span class="field-label">
{t('conn.wfUsageLabel')}<em class="req">*</em>
<span class="label-aux">
{#if wfAnalysis.usage}
{t('conn.wfUsageAuto', { usage: usageLabel(wfAnalysis.usage) })}
{:else}
{t('conn.wfUsageNeedPick')}
{/if}
</span>
</span>
<div
class="a-seg usage-seg"
role="radiogroup"
aria-label={t('conn.wfUsageLabel')}
>
{#each WORKFLOW_USAGES as u (u)}
<button
type="button"
aria-pressed={wfUsage === u}
onclick={() => (wfUsage = u)}
>
{usageLabel(u)}
</button>
{/each}
</div>
</div>
{#if wfOutputRows.length}
<div class="field">
<span class="field-label">
{t('conn.wfOutputLabel')}<em class="req">*</em>
<span class="label-aux">{t('conn.wfOutputNeedPick')}</span>
</span>
<div class="slot-rows">
{#each wfOutputRows as row (row.nodeId)}
<div class="slot-row" class:off={!row.picked}>
<label class="out-check">
<input
type="checkbox"
checked={row.picked}
onchange={(e) =>
(wfOutputPicked = {
...wfOutputPicked,
[row.nodeId]: e.currentTarget.checked,
})}
/>
<span class="slot-id mono">{row.nodeId}</span>
<span class="slot-name" title={row.class_type}>{row.label}</span
>
</label>
<select
class="a-select"
aria-label={t('conn.wfOutputKindAria')}
disabled={!row.picked}
value={row.kind}
onchange={(e) =>
(wfOutputKind = {
...wfOutputKind,
[row.nodeId]: e.currentTarget.value as 'image' | 'video',
})}
>
<option value="image">{t('conn.wfKindImage')}</option>
<option value="video">{t('conn.wfKindVideo')}</option>
</select>
</div>
{/each}
</div>
<span class="field-hint">{t('conn.wfOutputHint')}</span>
</div>
{/if}
{#if wfSlotRows.length}
<div class="field">
<span class="field-label">{t('conn.wfSlotsLabel')}</span>
<div class="slot-rows">
{#each wfSlotRows as row (row.nodeId)}
<div class="slot-row">
<span class="slot-id mono">{row.nodeId}</span>
<span class="slot-name">{row.label}</span>
{#if row.fixed}
<span class="tag">{t('wfRole.reference_image')}</span>
{:else}
<select
class="a-select"
aria-label={row.label}
value={row.role}
onchange={(e) =>
(wfRoleOverrides = {
...wfRoleOverrides,
[row.nodeId]: e.currentTarget.value,
})}
>
{#each ['image', 'first_frame', 'last_frame', 'reference_image', 'mask'] as r (r)}
<option value={r}>{t(`wfRole.${r}`)}</option>
{/each}
</select>
{/if}
</div>
{/each}
</div>
<span class="field-hint">{t('conn.wfSlotsHint')}</span>
</div>
{/if}
<p class="params">
{t('conn.wfParams', { n: wfParamPreview.length })}
{#if wfParamPreview.length}
<span class="params-list"
>{wfParamPreview.slice(0, 8).join(' · ')}{wfParamPreview.length > 8
? ' …'
: ''}</span
>
{/if}
</p>
{#if (wfAnalysis.warnings ?? []).length}
<ul class="warnings">
{#each wfAnalysis.warnings as w (w.node_id + w.code)}
<li class:err={w.level === 'error'}>{w.message}</li>
{/each}
</ul>
{/if}
<div class="actions between">
<Button
variant="secondary"
size="sm"
disabled={$wfImportMutation.isPending}
onclick={() => (wfStep = 'input')}
>
{t('conn.wfBack')}
</Button>
<span
class="need-test"
class:passed={wfSaveable && wfImportName.trim() !== ''}
>
{wfUsage
? wfOutputCandidates.length && wfOutputPickedCount === 0
? t('conn.wfOutputPick')
: usageLabel(wfUsage)
: t('conn.wfUsageNeedPick')}
</span>
<Button
variant="primary"
size="sm"
disabled={!wfSaveable || !wfImportName.trim()}
loading={$wfImportMutation.isPending}
onclick={submitWfImport}
>
{$wfImportMutation.isPending
? t('conn.wfImporting')
: t('conn.wfConfirmSave')}
</Button>
</div>
<div class="raw">
<button
type="button"
class="raw-toggle"
onclick={() => (showRawJson = !showRawJson)}
>
<Icon name="file" size={13} />
{showRawJson ? t('wfd.hideRaw') : t('wfd.showRaw')}
</button>
{#if showRawJson}
<pre class="raw-json mono">{wfJsonText}</pre>
{/if}
</div>
{/if}
</Drawer>
<style>
.hint {
margin: 0 0 12px;
font-size: 12px;
color: var(--text-2);
line-height: 1.6;
}
.req {
color: var(--err);
font-style: normal;
margin-left: 2px;
}
.label-aux {
margin-left: auto;
font-size: 10.5px;
font-weight: 400;
color: var(--text-3);
}
.a-select.full {
width: 100%;
}
.json {
min-height: 128px;
font-size: 11.5px;
font-family: var(--mono);
}
.file-row {
display: flex;
align-items: center;
gap: 10px;
margin-top: 8px;
flex-wrap: wrap;
}
.file-btn {
display: inline-flex;
align-items: center;
gap: 6px;
min-height: 30px;
padding: 0 12px;
border-radius: var(--r-sm);
border: 1px solid var(--line-2);
background: var(--bg-3);
color: var(--text-2);
font-size: 12px;
cursor: pointer;
white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
.file-btn:hover {
color: var(--text);
border-color: var(--line-2);
}
}
.file-btn input {
display: none;
}
.need-test {
font-size: 11px;
color: var(--text-3);
}
.need-test.passed {
color: var(--ok);
}
.actions {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 10px;
margin-top: 12px;
}
.actions.between {
border-top: 1px solid var(--line);
padding-top: 12px;
flex-wrap: wrap;
}
.actions.between .need-test {
margin-right: auto;
}
/* ---------------- four-step checklist ---------------- */
.checks {
list-style: none;
margin: 0 0 12px;
padding: 0;
display: flex;
flex-direction: column;
gap: 4px;
counter-reset: step;
}
.check {
display: flex;
align-items: flex-start;
gap: 10px;
padding: 7px 10px;
border-radius: var(--r-sm);
background: var(--bg-2);
border: 1px solid var(--line);
animation: check-in var(--d-enter) var(--ease-out);
}
@keyframes check-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
:global([data-reduce='1']) .check {
animation: none;
}
@media (prefers-reduced-motion: reduce) {
.check {
animation: none;
}
}
.mark {
width: 18px;
height: 18px;
margin-top: 1px;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
background: var(--bg-4);
color: var(--text-3);
}
.check.state-ok .mark {
background: var(--ok-soft);
color: var(--ok);
}
.check.state-fail .mark {
background: var(--err-soft);
color: var(--err);
}
.check.state-warn .mark {
background: var(--warn-soft);
color: var(--warn);
}
.check-text {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.check-label {
font-size: 12.5px;
font-weight: 600;
color: var(--text);
}
.check-line {
font-size: 11.5px;
color: var(--text-2);
line-height: 1.55;
word-break: break-all;
}
.check.state-ok .check-line {
color: var(--ok);
}
.check.state-fail .check-line {
color: var(--err);
}
.check.state-warn .check-line {
color: var(--warn);
}
.suggest {
margin: 0;
font-size: 11px;
color: var(--text-3);
}
.check-toggle {
align-self: flex-start;
background: none;
border: none;
padding: 0;
font-family: inherit;
font-size: 11px;
color: var(--text-2);
text-decoration: underline;
cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
.check-toggle:hover {
color: var(--text);
}
}
.findings {
margin: 2px 0 0;
padding: 0;
list-style: none;
display: flex;
flex-direction: column;
gap: 4px;
}
.findings li {
display: flex;
flex-direction: column;
gap: 2px;
padding: 6px 8px;
border-radius: var(--r-sm);
background: var(--err-soft);
}
.finding-msg {
font-size: 11.5px;
color: var(--text);
line-height: 1.5;
}
.finding-hint {
font-size: 10.5px;
color: var(--text-3);
line-height: 1.5;
}
.recheck {
flex-shrink: 0;
background: none;
border: none;
padding: 0;
font-family: inherit;
font-size: 11px;
color: var(--text-2);
text-decoration: underline;
cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
.recheck:hover {
color: var(--text);
}
}
.recheck:disabled {
opacity: 0.6;
cursor: default;
}
.note {
display: flex;
align-items: flex-start;
gap: 8px;
margin: 0 0 10px;
padding: 9px 12px;
border-radius: var(--r-sm);
background: var(--accent-soft);
color: var(--text-2);
}
.note :global(.icon) {
color: var(--accent);
flex-shrink: 0;
margin-top: 2px;
}
.note.fatal {
background: var(--err-soft);
}
.note.fatal :global(.icon) {
color: var(--err);
}
.note p {
margin: 0;
font-size: 11.5px;
line-height: 1.55;
}
.evidence {
margin: 0 0 12px;
padding: 0 0 0 4px;
list-style: none;
display: flex;
flex-direction: column;
gap: 3px;
}
.evidence li {
font-size: 11px;
color: var(--text-3);
line-height: 1.5;
}
.evidence li::before {
content: '·';
margin-right: 6px;
color: var(--accent);
}
.usage-seg {
display: flex;
flex-wrap: wrap;
width: 100%;
box-sizing: border-box;
}
.usage-seg > button {
flex: 1 1 30%;
white-space: normal;
height: auto;
min-height: 26px;
padding: 4px 8px;
}
.slot-rows {
display: flex;
flex-direction: column;
gap: 5px;
}
.slot-row {
display: flex;
align-items: center;
gap: 8px;
padding: 5px 8px;
border-radius: var(--r-sm);
background: var(--bg-2);
border: 1px solid var(--line);
}
.slot-id {
font-size: 10.5px;
color: var(--text-3);
min-width: 52px;
}
.slot-name {
flex: 1;
min-width: 0;
font-size: 12px;
color: var(--text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.slot-row .a-select {
max-width: 116px;
}
.slot-row.off {
opacity: 0.55;
}
.out-check {
display: flex;
align-items: center;
gap: 8px;
flex: 1;
min-width: 0;
cursor: pointer;
}
.out-check input[type='checkbox'] {
accent-color: var(--accent);
}
.tag {
display: inline-flex;
align-items: center;
padding: 2px 9px;
border-radius: 999px;
font-size: 10.5px;
font-weight: 600;
color: var(--text-2);
background: var(--bg-4);
}
.params {
margin: 0 0 10px;
font-size: 11.5px;
color: var(--text-3);
}
.params-list {
margin-left: 6px;
color: var(--text-2);
}
.warnings {
margin: 0 0 10px;
padding: 8px 12px;
list-style: none;
border-radius: var(--r-sm);
background: var(--err-soft);
display: flex;
flex-direction: column;
gap: 3px;
}
.warnings li {
font-size: 11px;
line-height: 1.5;
color: var(--text-2);
}
.warnings li.err {
color: var(--err);
}
.raw {
margin-top: 14px;
border-top: 1px dashed var(--line);
padding-top: 10px;
}
.raw-toggle {
display: inline-flex;
align-items: center;
gap: 6px;
background: none;
border: none;
padding: 0;
font-family: inherit;
font-size: 11.5px;
color: var(--text-2);
cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
.raw-toggle:hover {
color: var(--text);
}
}
.raw-json {
margin: 8px 0 0;
padding: 10px;
max-height: 220px;
overflow: auto;
border-radius: var(--r-sm);
background: var(--bg);
border: 1px solid var(--line);
font-size: 10.5px;
line-height: 1.5;
color: var(--text-2);
white-space: pre-wrap;
word-break: break-all;
}
</style>