HEL-733: align approved motion and audit remaining sample gaps
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import type { Action } from "svelte/action";
|
||||
|
||||
/** HEL-716: interacting with an arriving result skips its development effect. */
|
||||
export const finishAnimations: Action<HTMLElement> = (node) => {
|
||||
const finish = () => {
|
||||
for (const animation of node.getAnimations({ subtree: true })) {
|
||||
if (animation.playState === "running") animation.finish();
|
||||
}
|
||||
};
|
||||
node.addEventListener("pointerdown", finish);
|
||||
node.addEventListener("keydown", finish);
|
||||
return {
|
||||
destroy() {
|
||||
node.removeEventListener("pointerdown", finish);
|
||||
node.removeEventListener("keydown", finish);
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import "./workspace.css";
|
||||
import { reduceMotion } from "$lib/reduceMotion.svelte";
|
||||
import { onMount, untrack } from "svelte";
|
||||
import { page } from "$app/state";
|
||||
import { goto } from "$app/navigation";
|
||||
@@ -310,8 +311,9 @@
|
||||
if (!editing && results.length) openResult(results[0]);
|
||||
});
|
||||
});
|
||||
onMount(() => {
|
||||
if (!particles) return;
|
||||
$effect(() => {
|
||||
if (!particles || activeId || reduceMotion.manual || reduceMotion.system)
|
||||
return;
|
||||
const canvas = particles,
|
||||
ctx = canvas.getContext("2d");
|
||||
if (!ctx) return;
|
||||
@@ -364,9 +366,17 @@
|
||||
}
|
||||
raf = requestAnimationFrame(frame);
|
||||
};
|
||||
frame();
|
||||
const visibility = () => {
|
||||
cancelAnimationFrame(raf);
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
if (!document.hidden) frame();
|
||||
};
|
||||
document.addEventListener("visibilitychange", visibility);
|
||||
visibility();
|
||||
return () => {
|
||||
cancelAnimationFrame(raf);
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
document.removeEventListener("visibilitychange", visibility);
|
||||
observer.disconnect();
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { storageGet, storageSet, storageRemove } from '$lib/storage';
|
||||
import { resolve } from '$app/paths';
|
||||
import { onMount, untrack } from 'svelte';
|
||||
import { SvelteMap } from 'svelte/reactivity';
|
||||
@@ -120,7 +121,7 @@
|
||||
|
||||
let activeKey = $state<string>(
|
||||
(() => {
|
||||
const stored = localStorage.getItem('calliope.agents.activeKey');
|
||||
const stored = storageGet('calliope.agents.activeKey');
|
||||
return stored && (ALL_KEYS as readonly string[]).includes(stored)
|
||||
? stored
|
||||
: 'script';
|
||||
@@ -160,7 +161,7 @@
|
||||
return;
|
||||
}
|
||||
const stored = Number(
|
||||
localStorage.getItem(`calliope.agents.session.${key}`),
|
||||
storageGet(`calliope.agents.session.${key}`),
|
||||
);
|
||||
const found = list.find((s) => s.id === stored) ?? list[0];
|
||||
activeId = found.id;
|
||||
@@ -168,14 +169,14 @@
|
||||
|
||||
function rememberSession(key: string, id: number | null) {
|
||||
if (id != null)
|
||||
localStorage.setItem(`calliope.agents.session.${key}`, String(id));
|
||||
else localStorage.removeItem(`calliope.agents.session.${key}`);
|
||||
storageSet(`calliope.agents.session.${key}`, String(id));
|
||||
else storageRemove(`calliope.agents.session.${key}`);
|
||||
}
|
||||
|
||||
function selectAgent(key: string) {
|
||||
if (sendPending || uploadPending || projectPending) return;
|
||||
|
||||
localStorage.setItem('calliope.agents.activeKey', key);
|
||||
storageSet('calliope.agents.activeKey', key);
|
||||
activeKey = key;
|
||||
resetStreaming();
|
||||
}
|
||||
@@ -927,7 +928,7 @@
|
||||
...agentPreferences,
|
||||
[activeKey]: { ...currentPreference, ...patch },
|
||||
};
|
||||
localStorage.setItem(
|
||||
storageSet(
|
||||
'calliope.reference.agentPreferences',
|
||||
JSON.stringify(agentPreferences),
|
||||
);
|
||||
@@ -935,10 +936,10 @@
|
||||
onMount(() => {
|
||||
try {
|
||||
pinnedAgents = JSON.parse(
|
||||
localStorage.getItem('calliope.reference.agentPins') || '[]',
|
||||
storageGet('calliope.reference.agentPins') || '[]',
|
||||
);
|
||||
agentPreferences = JSON.parse(
|
||||
localStorage.getItem('calliope.reference.agentPreferences') || '{}',
|
||||
storageGet('calliope.reference.agentPreferences') || '{}',
|
||||
);
|
||||
} catch {
|
||||
// Unavailable or malformed local storage keeps the default agent preferences.
|
||||
@@ -948,7 +949,7 @@
|
||||
pinnedAgents = pinnedAgents.includes(key)
|
||||
? pinnedAgents.filter((p) => p !== key)
|
||||
: [...pinnedAgents, key];
|
||||
localStorage.setItem(
|
||||
storageSet(
|
||||
'calliope.reference.agentPins',
|
||||
JSON.stringify(pinnedAgents),
|
||||
);
|
||||
@@ -1049,7 +1050,7 @@
|
||||
project: id,
|
||||
},
|
||||
};
|
||||
localStorage.setItem(
|
||||
storageSet(
|
||||
'calliope.reference.agentPreferences',
|
||||
JSON.stringify(agentPreferences),
|
||||
);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { resolve } from '$app/paths';
|
||||
import { finishAnimations } from '$lib/actions/finishAnimations';
|
||||
import { reduceMotion } from '$lib/reduceMotion.svelte';
|
||||
import { untrack, type Snippet } from 'svelte';
|
||||
import Modal from '$lib/components/ui/Modal.svelte';
|
||||
import ImageLightbox from '$lib/components/ImageLightbox.svelte';
|
||||
@@ -102,6 +104,24 @@
|
||||
outIndex = 0;
|
||||
});
|
||||
|
||||
// Only a live transition to a completed result develops. Opening old history
|
||||
// or changing the theme never replays an arrival effect.
|
||||
let arriving = $state(false);
|
||||
let previous: { id: number; status: string } | null = null;
|
||||
$effect(() => {
|
||||
if (reduceMotion.manual || reduceMotion.system) arriving = false;
|
||||
});
|
||||
$effect(() => {
|
||||
const id = job?.id,
|
||||
status = job?.status;
|
||||
if (!id || previous?.id !== id || status !== 'done') {
|
||||
arriving = false;
|
||||
} else if (previous.status === 'running' || previous.status === 'pending') {
|
||||
arriving = !untrack(() => reduceMotion.manual || reduceMotion.system);
|
||||
}
|
||||
// Repeated done snapshots must not erase the effect before the first paint.
|
||||
previous = id && status ? { id, status } : null;
|
||||
});
|
||||
const st = $derived(job ? jobStatusInfo(job) : null);
|
||||
// §3.4 红/琥珀界线: amber only when the task SUCCEEDED but its files
|
||||
// cannot be fetched — the failed case stays red.
|
||||
@@ -208,7 +228,10 @@
|
||||
{#if output && video}
|
||||
<!-- svelte-ignore a11y_media_has_caption -->
|
||||
<div
|
||||
class="print a-photo"
|
||||
class="print a-photo a-viewfinder a-in-frame"
|
||||
class:a-result-develop={arriving}
|
||||
use:finishAnimations
|
||||
onanimationend={() => (arriving = false)}
|
||||
style:width={fitted > 0 ? `${naturalWidth * fitted}px` : '100%'}
|
||||
style:height={fitted > 0 ? `${naturalHeight * fitted}px` : '100%'}
|
||||
>
|
||||
@@ -248,7 +271,10 @@
|
||||
</div>
|
||||
{:else if output}
|
||||
<div
|
||||
class="print a-photo"
|
||||
class="print a-photo a-viewfinder a-in-frame"
|
||||
class:a-result-develop={arriving}
|
||||
use:finishAnimations
|
||||
onanimationend={() => (arriving = false)}
|
||||
style:width={fitted > 0 ? `${naturalWidth * fitted}px` : '100%'}
|
||||
style:height={fitted > 0 ? `${naturalHeight * fitted}px` : '100%'}
|
||||
>
|
||||
@@ -275,6 +301,24 @@
|
||||
style:left={`${compareAt}%`}
|
||||
></div>{/if}
|
||||
</div>
|
||||
{:else if job.status === 'running' || job.status === 'pending'}
|
||||
<div class="generation-card" aria-label={st.label}>
|
||||
<div class="generation-grain" aria-hidden="true"></div>
|
||||
{#if job.status === 'running'}<div
|
||||
class="a-scan-beam"
|
||||
aria-hidden="true"
|
||||
></div>{/if}
|
||||
<div class="generation-info">
|
||||
<b>{st.label}</b>
|
||||
{#if progress > 0}<div
|
||||
class="a-progress"
|
||||
style:--p={progress / 100}
|
||||
>
|
||||
<i></i>
|
||||
</div>{/if}
|
||||
<span>{st.detail}</span>
|
||||
</div>
|
||||
</div>
|
||||
{:else if fileGone}
|
||||
<div class="stage-empty gone">
|
||||
<span>{t('desk.missingTitle')}</span>
|
||||
@@ -653,14 +697,15 @@
|
||||
min-width: 0;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
background: var(--desk-media-bg);
|
||||
box-shadow: var(--media-shadow);
|
||||
border-radius: var(--desk-media-radius);
|
||||
}
|
||||
.big-play {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
translate: var(--desk-player-offset) var(--desk-player-offset);
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border-radius: 50%;
|
||||
@@ -684,6 +729,37 @@
|
||||
.print :global(.a-fix) {
|
||||
display: none;
|
||||
}
|
||||
.generation-card {
|
||||
width: var(--generation-width);
|
||||
aspect-ratio: var(--ar, 1);
|
||||
max-height: var(--generation-max-height);
|
||||
border-radius: var(--generation-radius);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: var(--gen-bg);
|
||||
border: 1px solid var(--line-2);
|
||||
}
|
||||
.generation-grain {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
opacity: var(--generation-grain-opacity);
|
||||
background-image: repeating-radial-gradient(
|
||||
circle at 17% 32%,
|
||||
var(--grain) 0 1px,
|
||||
transparent 1px 3px
|
||||
);
|
||||
}
|
||||
.generation-info {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: var(--generation-info-padding);
|
||||
background: var(--generation-info-bg);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--generation-info-gap);
|
||||
}
|
||||
.stage-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -26,13 +26,14 @@
|
||||
{#each sorted as job (job.id)}
|
||||
{@const status = jobStatusInfo(job)}
|
||||
<button
|
||||
class="history-take"
|
||||
class="history-take a-viewfinder"
|
||||
class:a-in-frame={selectedId === job.id}
|
||||
class:selected={selectedId === job.id}
|
||||
onclick={() => onSelect(job)}
|
||||
aria-label={'查看历史 #' + job.id + ' · ' + status.label}
|
||||
aria-pressed={selectedId === job.id}
|
||||
>
|
||||
<div class="thumb">
|
||||
<div class="thumb" class:placeholder={!job.output_paths[0] || status.tone !== 'ok'}>
|
||||
{#if job.output_paths[0] && status.tone === 'ok'}
|
||||
{#if isVideoOutput(job, job.output_paths[0])}<span
|
||||
class="video-mark">▷</span
|
||||
@@ -96,52 +97,63 @@
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
padding: 8px 6px;
|
||||
padding: var(--desk-history-padding);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--desk-history-gap);
|
||||
align-items: center;
|
||||
}
|
||||
.history-take {
|
||||
display: block;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding: 3px;
|
||||
margin-bottom: 8px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: var(--r-sm);
|
||||
}
|
||||
.history-take.selected {
|
||||
border-color: var(--scene);
|
||||
background: color-mix(in srgb, var(--scene) 10%, transparent);
|
||||
padding: 0;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--desk-media-radius);
|
||||
background: var(--desk-media-bg);
|
||||
flex: none;
|
||||
}
|
||||
.history-take.selected { border-color: transparent; }
|
||||
.thumb {
|
||||
position: relative;
|
||||
aspect-ratio: 1;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: var(--bg-0);
|
||||
border-radius: var(--r-xs);
|
||||
background: var(--desk-media-bg);
|
||||
border-radius: inherit;
|
||||
overflow: hidden;
|
||||
font-size: 10px;
|
||||
}
|
||||
img,
|
||||
video {
|
||||
.thumb.placeholder { aspect-ratio: 1; display: grid; place-items: center; }
|
||||
img, video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
object-fit: contain;
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
.video-mark {
|
||||
position: absolute;
|
||||
bottom: 3px;
|
||||
right: 3px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 4px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
z-index: 1;
|
||||
color: var(--on-media);
|
||||
font-size: 24px;
|
||||
text-shadow: 0 1px 6px var(--media-scrim);
|
||||
font-size: 10px;
|
||||
background: var(--desk-history-label-bg);
|
||||
}
|
||||
.failed {
|
||||
color: var(--err);
|
||||
}
|
||||
small {
|
||||
font-family: var(--mono);
|
||||
font-size: 10px;
|
||||
color: var(--tx-3);
|
||||
position: absolute;
|
||||
left: 3px;
|
||||
top: 3px;
|
||||
font: 600 9.5px var(--mono);
|
||||
padding: 1px 4px;
|
||||
border-radius: 3px;
|
||||
background: var(--desk-history-label-bg);
|
||||
color: var(--desk-history-label-color);
|
||||
}
|
||||
p {
|
||||
text-align: center;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import { SvelteMap, SvelteSet, SvelteURL } from 'svelte/reactivity';
|
||||
import { page } from '$app/state';
|
||||
import { goto } from '$app/navigation';
|
||||
import '$lib/components/ui/Icon.svelte';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import Modal from '$lib/components/ui/Modal.svelte';
|
||||
import AppShell from '$lib/components/shell/AppShell.svelte';
|
||||
import Composer from '$lib/components/generate/Composer.svelte';
|
||||
@@ -1152,7 +1152,7 @@
|
||||
/>
|
||||
{/snippet}
|
||||
|
||||
<AppShell active={kind} title="创作台" workspace>
|
||||
<AppShell active={kind} title="创作台" workspace hideHeader>
|
||||
<div
|
||||
class="reference-desk"
|
||||
class:focused={focusMode}
|
||||
@@ -1222,7 +1222,7 @@
|
||||
</div>{/if}
|
||||
<div class="studio-layout">
|
||||
<section class="viewer" aria-label="查看生成结果">
|
||||
<div class="preview-area">
|
||||
<div class="preview-area" style:background="var(--desk-stage-background)">
|
||||
{#if selectedJob}<Artboard
|
||||
main
|
||||
comparePath={allJobs.find(
|
||||
@@ -1252,22 +1252,9 @@
|
||||
onSendToSlot={sendToSlot}
|
||||
onDelete={requestDelete}
|
||||
/>{:else}<div class="desk-welcome">
|
||||
<span class="eyebrow">● AI 创作引擎</span>
|
||||
<h1>让灵感,成为作品</h1>
|
||||
<div class="desk-emblem">{kind === 'image' ? '◈' : '▷'}</div>
|
||||
<div class="workflow-description">
|
||||
<strong
|
||||
>{currentWorkflow?.name ??
|
||||
currentMeta?.name ??
|
||||
'选择工作流,开始创作'}</strong
|
||||
>
|
||||
<p>
|
||||
{currentWorkflow?.description ??
|
||||
currentMeta?.description ??
|
||||
'选择左侧工作流,填写下方提示词与参数。'}
|
||||
</p>
|
||||
<small>生成结果在这里显示,视频由你手动播放。</small>
|
||||
</div>
|
||||
<div class="desk-emblem"><Icon name={kind === 'image' ? 'image' : 'film'} size={22} /></div>
|
||||
<div class="empty-title">作品会在这里完整显示</div>
|
||||
<div class="empty-hint">选工作流 → 填素材与提示词 → 开始生成</div>
|
||||
</div>{/if}
|
||||
</div>
|
||||
</section>
|
||||
@@ -1643,38 +1630,20 @@
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 12px;
|
||||
background: var(--bg-1);
|
||||
}
|
||||
.desk-welcome h1 {
|
||||
font-size: 24px;
|
||||
font-weight: 550;
|
||||
margin: 0;
|
||||
gap: var(--desk-empty-gap);
|
||||
color: var(--tx-3);
|
||||
}
|
||||
.desk-emblem {
|
||||
color: var(--accent);
|
||||
font-size: 56px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.eyebrow {
|
||||
color: var(--accent);
|
||||
font-size: 10px;
|
||||
}
|
||||
.workflow-description {
|
||||
max-width: 400px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
.workflow-description strong {
|
||||
font-size: 13px;
|
||||
color: var(--text-2);
|
||||
}
|
||||
.workflow-description p,
|
||||
.workflow-description small {
|
||||
font-size: 11px;
|
||||
color: var(--text-3);
|
||||
width: var(--desk-empty-ring);
|
||||
height: var(--desk-empty-ring);
|
||||
border-radius: 50%;
|
||||
border: 1px dashed var(--line-3);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: color-mix(in srgb, var(--scene) 70%, var(--hi));
|
||||
}
|
||||
.empty-title { font-size: var(--desk-empty-title-size); color: var(--tx-2); }
|
||||
.empty-hint { font-size: var(--desk-empty-hint-size); }
|
||||
.history-full {
|
||||
height: min(680px, 68vh);
|
||||
}
|
||||
|
||||
@@ -17,11 +17,14 @@
|
||||
import { storageGet, storageSet } from "$lib/storage";
|
||||
import Modal from "$lib/components/ui/Modal.svelte";
|
||||
import ThemeChoices from "./ThemeChoices.svelte";
|
||||
import { themeStorageUnavailable } from "$lib/theme";
|
||||
|
||||
/** Desktop studio shell: six named sections, project scope, search,
|
||||
* real queue and connection status. Individual tools keep their routes. */
|
||||
interface Props {
|
||||
workspace?: boolean;
|
||||
/** The workspace supplies its own full-height header (creative desk). */
|
||||
hideHeader?: boolean;
|
||||
pageHeader?: import("svelte").Snippet<[{ openSearch: () => void }]>;
|
||||
active: NavId;
|
||||
title: string;
|
||||
@@ -37,6 +40,7 @@
|
||||
children,
|
||||
pageHeader,
|
||||
workspace = false,
|
||||
hideHeader = false,
|
||||
}: Props = $props();
|
||||
|
||||
let paletteOpen = $state(false);
|
||||
@@ -282,7 +286,9 @@
|
||||
class="app-body"
|
||||
style:background={pageHeader ? "var(--manage-page-background)" : undefined}
|
||||
>
|
||||
{#if pageHeader}{@render pageHeader({ openSearch: openPalette })}{:else}
|
||||
{#if pageHeader}{@render pageHeader({
|
||||
openSearch: openPalette,
|
||||
})}{:else if !hideHeader}
|
||||
<header class="topbar">
|
||||
<div class="breadcrumb">
|
||||
{currentNav?.label ?? title}<span>/</span><span class="page-name"
|
||||
@@ -333,16 +339,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<CommandPalette bind:open={paletteOpen} />
|
||||
<Modal bind:open={themeOpen} title="外观主题">
|
||||
<Modal bind:open={themeOpen} title="界面主题" rail>
|
||||
{#snippet headerActions()}<span class="theme-subtitle">同一布局与功能,只换灯光</span>{/snippet}
|
||||
<ThemeChoices compact />
|
||||
<label class="theme-motion"
|
||||
><Switch
|
||||
checked={reduceMotion.system || reduceMotion.manual}
|
||||
{#snippet footer()}
|
||||
<div class="theme-motion"><span class="theme-foot-note" role="status"><Icon name={$themeStorageUnavailable ? "close" : "check"} size={18} />{$themeStorageUnavailable ? "浏览器禁止本地存储:本次有效,其他操作不受影响" : "已记住,下次打开沿用 · 正在编辑的内容不受影响"}</span><button class="a-btn secondary sm"
|
||||
disabled={reduceMotion.system}
|
||||
label={t("shell.reduceMotion")}
|
||||
onchange={setReduceMotion}
|
||||
/><span>减少动效</span></label
|
||||
>
|
||||
onclick={() => setReduceMotion(!reduceMotion.manual)}
|
||||
aria-pressed={!reduceMotion.system && !reduceMotion.manual}
|
||||
><Icon name="motion" size={14} />{reduceMotion.system || reduceMotion.manual ? "动效关" : "动效开"}</button></div>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
<style>
|
||||
@@ -358,15 +364,20 @@
|
||||
);
|
||||
box-shadow: 0 0 0 1px var(--line-3);
|
||||
}
|
||||
.theme-subtitle { font-size: var(--theme-pop-note-size); color: var(--tx-3); }
|
||||
.theme-foot-note { display: flex; align-items: center; gap: var(--theme-pop-footer-gap); }
|
||||
.theme-motion {
|
||||
--button-sm-height: var(--theme-pop-button-height);
|
||||
--button-sm-padding: var(--theme-pop-button-padding);
|
||||
--button-sm-font-size: var(--theme-pop-button-size);
|
||||
--button-sm-radius: var(--theme-pop-button-radius);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 14px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid var(--line);
|
||||
font-size: 12px;
|
||||
color: var(--tx-2);
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
gap: var(--theme-pop-footer-gap);
|
||||
font-size: var(--theme-pop-note-size);
|
||||
color: var(--tx-3);
|
||||
}
|
||||
.nav-item[aria-current="page"] :global(svg) {
|
||||
color: var(--nav-c, var(--gold));
|
||||
@@ -385,7 +396,7 @@
|
||||
grid-template-columns: var(--rail-expanded-width) minmax(0, 1fr);
|
||||
}
|
||||
.sidebar {
|
||||
background: var(--bg-1);
|
||||
background: var(--rail-background);
|
||||
border-right: 1px solid var(--line);
|
||||
--icon-stroke: var(--manage-icon-stroke);
|
||||
padding: var(--rail-padding);
|
||||
@@ -560,6 +571,7 @@
|
||||
text-decoration: none;
|
||||
}
|
||||
.app-body {
|
||||
animation: a-page-enter var(--t-slow) var(--ease-out);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import Icon from "$lib/components/ui/Icon.svelte";
|
||||
import { THEMES, theme, setTheme, themeStorageUnavailable } from "$lib/theme";
|
||||
let {
|
||||
compact = false,
|
||||
@@ -62,17 +63,17 @@
|
||||
: item.name}{#if tiles && item.id === "night"}<span
|
||||
class="mg-tag theme-default">默认</span
|
||||
>{/if}</strong
|
||||
><small>{tiles ? item.tone : item.english}</small>{#if !tiles}<span
|
||||
><small>{tiles ? item.tone : item.english + " · " + item.tone}</small>{#if !tiles}<span
|
||||
>{item.description}</span
|
||||
>{/if}</span
|
||||
>
|
||||
<span class="check" class:tile-check={tiles} aria-hidden="true"
|
||||
>{$theme === item.id ? "✓" : ""}</span
|
||||
>{#if $theme === item.id}<Icon name="check" size={14} />{/if}</span
|
||||
>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{#if $themeStorageUnavailable}<p class="notice" role="status">
|
||||
{#if $themeStorageUnavailable && !compact}<p class="notice" role="status">
|
||||
浏览器禁止本地存储:本次有效,其他操作不受影响
|
||||
</p>{/if}
|
||||
|
||||
@@ -116,6 +117,26 @@
|
||||
flex-direction: column;
|
||||
}
|
||||
.choices.compact {
|
||||
--choice-box-sizing: border-box;
|
||||
--choice-description-size: var(--theme-pop-note-size);
|
||||
--choice-description-line: var(--theme-choice-description-line);
|
||||
--choice-gap: var(--theme-choice-gap);
|
||||
--choice-radius: var(--theme-choice-radius);
|
||||
--choice-border: transparent;
|
||||
--choice-hover-background: rgb(var(--ink) / .04);
|
||||
--choice-hover-border: var(--line-2);
|
||||
--choice-selected: color-mix(in srgb, var(--gold) 55%, transparent);
|
||||
--choice-selected-bg: color-mix(in srgb, var(--gold) 8%, transparent);
|
||||
--choice-tone-font: var(--theme-choice-english-font);
|
||||
--choice-preview-radius: var(--theme-choice-preview-radius);
|
||||
--choice-preview-art: var(--theme-preview-art);
|
||||
--choice-art-shadow: 0 0 0 1px var(--line-2);
|
||||
--choice-art-border: 0;
|
||||
--choice-dock-radius: 3px;
|
||||
--choice-dock-width: 100%;
|
||||
--choice-dock-border: 1px solid var(--line-2);
|
||||
--choice-dock-background: var(--bg-3);
|
||||
gap: var(--theme-choice-list-gap);
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.choice {
|
||||
@@ -125,7 +146,7 @@
|
||||
grid-template-columns: minmax(0, 1fr) var(--choice-check-width, 18px);
|
||||
gap: var(--choice-gap, 8px);
|
||||
padding: 8px;
|
||||
border: 1px solid var(--line-2);
|
||||
border: 1px solid var(--choice-border, var(--line-2));
|
||||
border-radius: var(--choice-radius, var(--r-md));
|
||||
background: var(--bg-2);
|
||||
color: var(--tx-1);
|
||||
@@ -133,18 +154,20 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
.choice:hover {
|
||||
border-color: var(--line-3);
|
||||
border-color: var(--choice-hover-border, var(--line-3));
|
||||
background: var(--choice-hover-background, var(--bg-3));
|
||||
}
|
||||
.choice.selected {
|
||||
border-color: var(--choice-selected, var(--gold));
|
||||
box-shadow: var(--choice-shadow, none);
|
||||
background: var(--choice-selected-bg, var(--bg-2));
|
||||
}
|
||||
.choice:focus-visible {
|
||||
outline: 2px solid var(--info);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.compact .choice {
|
||||
font: var(--theme-choice-font);
|
||||
grid-template-columns: 76px minmax(0, 1fr) 18px;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -250,7 +273,8 @@
|
||||
}
|
||||
.copy > span {
|
||||
width: 100%;
|
||||
font-size: 11px;
|
||||
font-size: var(--choice-description-size, 11px);
|
||||
line-height: var(--choice-description-line, inherit);
|
||||
color: var(--tx-2);
|
||||
}
|
||||
.check {
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
children: Snippet;
|
||||
/** Open above a dock, retaining the shared dialog focus and keyboard behavior. */
|
||||
anchor?: HTMLElement | null;
|
||||
/** HEL-726 theme picker uses the same dialog behavior beside the rail. */
|
||||
rail?: boolean;
|
||||
headerActions?: Snippet;
|
||||
}
|
||||
|
||||
@@ -26,6 +28,7 @@
|
||||
footer,
|
||||
children,
|
||||
anchor = null,
|
||||
rail = false,
|
||||
headerActions,
|
||||
}: Props = $props();
|
||||
|
||||
@@ -129,6 +132,24 @@
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="modal-backdrop"
|
||||
style:--modal-overlay={rail ? 'transparent' : undefined}
|
||||
style:--modal-box-sizing={rail ? 'border-box' : undefined}
|
||||
style:--modal-width={rail ? 'var(--theme-pop-width)' : undefined}
|
||||
style:--modal-position={rail ? 'fixed' : undefined}
|
||||
style:--modal-left={rail ? 'var(--theme-pop-left)' : undefined}
|
||||
style:--modal-bottom={rail ? 'var(--theme-pop-bottom)' : undefined}
|
||||
style:--modal-border={rail ? '1px solid var(--line-2)' : undefined}
|
||||
style:--modal-bg={rail ? 'var(--bg-2)' : undefined}
|
||||
style:--modal-shadow={rail ? 'var(--theme-pop-shadow)' : undefined}
|
||||
style:--modal-origin={rail ? 'bottom left' : undefined}
|
||||
style:--modal-header-padding={rail ? 'var(--theme-pop-header-padding)' : undefined}
|
||||
style:--modal-title-size={rail ? 'var(--theme-pop-title-size)' : undefined}
|
||||
style:--modal-title-weight={rail ? '700' : undefined}
|
||||
style:--modal-header-gap={rail ? 'var(--theme-pop-header-gap)' : undefined}
|
||||
style:--modal-close-size={rail ? 'var(--theme-pop-button-height)' : undefined}
|
||||
style:--modal-body-padding={rail ? 'var(--theme-pop-body-padding)' : undefined}
|
||||
style:--modal-footer-padding={rail ? 'var(--theme-pop-footer-padding)' : undefined}
|
||||
style:--modal-footer-border={rail ? '1px solid var(--line)' : undefined}
|
||||
class:anchored={!!anchor}
|
||||
onclick={handleBackdropClick}
|
||||
>
|
||||
@@ -186,17 +207,23 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
background: var(--overlay);
|
||||
background: var(--modal-overlay, var(--overlay));
|
||||
animation: modal-fade var(--d-state) ease-out;
|
||||
}
|
||||
.modal-panel {
|
||||
width: min(520px, 100%);
|
||||
width: var(--modal-width, min(520px, 100%));
|
||||
box-sizing: var(--modal-box-sizing, content-box);
|
||||
position: var(--modal-position, static);
|
||||
left: var(--modal-left, auto);
|
||||
bottom: var(--modal-bottom, auto);
|
||||
border: var(--modal-border, 0);
|
||||
transform-origin: var(--modal-origin, center);
|
||||
max-height: calc(100vh - 96px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--float-bg);
|
||||
background: var(--modal-bg, var(--float-bg));
|
||||
border-radius: var(--r-lg);
|
||||
box-shadow: var(--shadow-float);
|
||||
box-shadow: var(--modal-shadow, var(--shadow-float));
|
||||
outline: none;
|
||||
animation: modal-rise var(--d-pop) var(--ease-out);
|
||||
}
|
||||
@@ -242,22 +269,22 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 18px 20px 0;
|
||||
gap: var(--modal-header-gap, 12px);
|
||||
padding: var(--modal-header-padding, 18px 20px 0);
|
||||
}
|
||||
.modal-title {
|
||||
margin: 0;
|
||||
font-family: var(--font-display);
|
||||
font-size: var(--fs-title);
|
||||
font-weight: 600;
|
||||
font-size: var(--modal-title-size, var(--fs-title));
|
||||
font-weight: var(--modal-title-weight, 600);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.modal-close {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
width: var(--modal-close-size, 28px);
|
||||
height: var(--modal-close-size, 28px);
|
||||
margin-left: auto;
|
||||
border: none;
|
||||
border-radius: var(--radius-sm);
|
||||
@@ -279,7 +306,7 @@
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.modal-body {
|
||||
padding: 16px 20px 20px;
|
||||
padding: var(--modal-body-padding, 16px 20px 20px);
|
||||
overflow-y: auto;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
@@ -289,7 +316,8 @@
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
padding: 0 20px 20px;
|
||||
padding: var(--modal-footer-padding, 0 20px 20px);
|
||||
border-top: var(--modal-footer-border, 0);
|
||||
}
|
||||
@keyframes modal-fade {
|
||||
from {
|
||||
@@ -302,7 +330,7 @@
|
||||
@keyframes modal-rise {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(8px);
|
||||
transform: translateY(var(--pop-enter-y)) scale(var(--pop-enter-scale));
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
|
||||
@@ -105,6 +105,7 @@ export const icons = {
|
||||
'<rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/>',
|
||||
stop: '<rect x="5" y="5" width="14" height="14" rx="2"/>',
|
||||
// Status
|
||||
motion: '<path d="M3 12h4l3-8 4 16 3-8h4"/>',
|
||||
check: '<path d="M20 6 9 17l-5-5"/>',
|
||||
star: '<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>',
|
||||
alert:
|
||||
|
||||
@@ -8,28 +8,31 @@ export const THEMES = [
|
||||
name: "夜片场",
|
||||
english: "Nocturne",
|
||||
tone: "深色 · 默认",
|
||||
description: "墨黑与钨丝金 · 沉浸式创作",
|
||||
description:
|
||||
"墨黑棚里一盏钨丝灯:作品最亮,金色只给“去做”。夜间与沉浸创作。",
|
||||
},
|
||||
{
|
||||
id: "day",
|
||||
name: "日光棚",
|
||||
english: "Daylight",
|
||||
tone: "浅色",
|
||||
description: "暖白纸面 · 白天办公与长时间审稿",
|
||||
description:
|
||||
"开窗的白天摄影棚:暖白纸面、墨色文字、琥珀主键。白天办公与长时间审稿。",
|
||||
},
|
||||
{
|
||||
id: "grade",
|
||||
name: "调色间",
|
||||
english: "Grading",
|
||||
tone: "中性深灰",
|
||||
description: "中性深灰 · 判断作品色彩",
|
||||
description:
|
||||
"调色室的中性灰:不给作品染色,场景色降饱和、主键为白。判断色彩、久盯不累。",
|
||||
},
|
||||
{
|
||||
id: "bluehour",
|
||||
name: "蓝调时刻",
|
||||
english: "Blue Hour",
|
||||
tone: "深蓝",
|
||||
description: "靛蓝与珊瑚 · 提案与灵感发散",
|
||||
description: "日落后的靛蓝天色配珊瑚主光,氛围最浓。提案、展示与灵感发散。",
|
||||
},
|
||||
] as const;
|
||||
export type ThemeId = (typeof THEMES)[number]["id"];
|
||||
|
||||
+146
-26
@@ -111,6 +111,8 @@ code,
|
||||
width: 100%;
|
||||
}
|
||||
.a-btn.primary {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border: var(--button-primary-border-width, 1px) solid transparent;
|
||||
border-bottom-width: 0;
|
||||
min-height: var(--button-primary-height, 40px);
|
||||
@@ -936,27 +938,6 @@ button.a-tile:disabled {
|
||||
border-radius: var(--r-sm);
|
||||
}
|
||||
|
||||
/* Reduced-motion baseline for components that still carry their own
|
||||
durations. Components that need a styled static fallback (Skeleton,
|
||||
ProgressBar indeterminate, StatusChip pulse) also handle this in their
|
||||
scoped styles. */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
animation-duration: 0.01ms !important;
|
||||
animation-iteration-count: 1 !important;
|
||||
transition-duration: 0.01ms !important;
|
||||
}
|
||||
}
|
||||
:root[data-reduce="1"] *,
|
||||
:root[data-reduce="1"] *::before,
|
||||
:root[data-reduce="1"] *::after {
|
||||
animation-duration: 0.01ms !important;
|
||||
animation-iteration-count: 1 !important;
|
||||
transition-duration: 0.01ms !important;
|
||||
}
|
||||
|
||||
/* Refract shared behavior: desktop composition, paper surfaces, direct feedback. */
|
||||
[hidden] {
|
||||
display: none !important;
|
||||
@@ -1036,13 +1017,22 @@ select:focus-visible {
|
||||
border-radius: inherit;
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
background-image: var(--lattice);
|
||||
z-index: -1;
|
||||
background-image:
|
||||
radial-gradient(
|
||||
var(--lattice-light-radius) circle at var(--pointer-x, 50%)
|
||||
var(--pointer-y, 50%),
|
||||
color-mix(in srgb, var(--scene) var(--lattice-scene), transparent),
|
||||
transparent 70%
|
||||
),
|
||||
var(--lattice);
|
||||
mask-image: radial-gradient(
|
||||
70px circle at var(--pointer-x, -100px) var(--pointer-y, -100px),
|
||||
#000,
|
||||
transparent
|
||||
var(--lattice-mask-radius) circle at var(--pointer-x, 50%)
|
||||
var(--pointer-y, 50%),
|
||||
#000 0,
|
||||
transparent var(--lattice-mask-end)
|
||||
);
|
||||
transition: opacity 180ms ease;
|
||||
transition: opacity var(--lattice-duration) var(--ease-out);
|
||||
}
|
||||
@media (hover: hover) and (pointer: fine) {
|
||||
.reference-option:hover::after {
|
||||
@@ -1072,3 +1062,133 @@ select:focus-visible {
|
||||
color: color-mix(in srgb, var(--sc-agent) 70%, var(--hi));
|
||||
border-color: color-mix(in srgb, var(--sc-agent) 35%, transparent);
|
||||
}
|
||||
|
||||
/* HEL-716 / HEL-726 effects: one shared source, theme values in themes.css. */
|
||||
@keyframes a-page-enter {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(var(--page-enter-y));
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
.a-btn.primary::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: var(--primary-sweep-width);
|
||||
left: var(--primary-sweep-from);
|
||||
background: var(--primary-sweep);
|
||||
transform: skewX(var(--primary-sweep-skew));
|
||||
transition: left 0s;
|
||||
pointer-events: none;
|
||||
}
|
||||
.a-btn.primary:hover:not(:disabled):not([aria-disabled="true"])::after {
|
||||
left: var(--primary-sweep-to);
|
||||
transition: left var(--t-reveal) var(--ease-out);
|
||||
}
|
||||
.a-result-develop > img,
|
||||
.a-result-develop > video {
|
||||
animation: var(--result-develop) var(--t-reveal) var(--ease-out);
|
||||
}
|
||||
@keyframes a-develop {
|
||||
0% {
|
||||
filter: blur(18px) brightness(1.8) saturate(0);
|
||||
opacity: 0.2;
|
||||
transform: scale(1.015);
|
||||
}
|
||||
60% {
|
||||
filter: blur(2px) brightness(1.1) saturate(0.8);
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
filter: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
@keyframes a-develop-day {
|
||||
0% {
|
||||
filter: blur(16px) brightness(1.35) sepia(0.6) saturate(0.2);
|
||||
opacity: 0.15;
|
||||
transform: scale(1.015);
|
||||
}
|
||||
60% {
|
||||
filter: blur(2px) sepia(0.12);
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
filter: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
@keyframes a-develop-grade {
|
||||
0% {
|
||||
filter: blur(10px) saturate(0);
|
||||
opacity: 0.25;
|
||||
}
|
||||
100% {
|
||||
filter: none;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
.a-scan-beam {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: var(--scan-width);
|
||||
left: calc(0% - var(--scan-width));
|
||||
background: var(--beam);
|
||||
animation: a-scan var(--scan-duration) var(--ease-io) infinite;
|
||||
pointer-events: none;
|
||||
}
|
||||
@keyframes a-scan {
|
||||
to {
|
||||
left: 100%;
|
||||
}
|
||||
}
|
||||
:root[data-reduce="1"] .a-scan-beam,
|
||||
:root[data-reduce="1"] .a-btn.primary::after {
|
||||
display: none;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.a-scan-beam,
|
||||
.a-btn.primary::after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.a-viewfinder::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: var(--viewfinder-inset);
|
||||
border-radius: inherit;
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
transition:
|
||||
opacity var(--t-base),
|
||||
inset var(--t-slow) var(--ease-out);
|
||||
background:
|
||||
linear-gradient(var(--viewfinder-color), var(--viewfinder-color)) top
|
||||
left/var(--viewfinder-length) var(--viewfinder-stroke) no-repeat,
|
||||
linear-gradient(var(--viewfinder-color), var(--viewfinder-color)) top
|
||||
left/var(--viewfinder-stroke) var(--viewfinder-length) no-repeat,
|
||||
linear-gradient(var(--viewfinder-color), var(--viewfinder-color)) top
|
||||
right/var(--viewfinder-length) var(--viewfinder-stroke) no-repeat,
|
||||
linear-gradient(var(--viewfinder-color), var(--viewfinder-color)) top
|
||||
right/var(--viewfinder-stroke) var(--viewfinder-length) no-repeat,
|
||||
linear-gradient(var(--viewfinder-color), var(--viewfinder-color)) bottom
|
||||
left/var(--viewfinder-length) var(--viewfinder-stroke) no-repeat,
|
||||
linear-gradient(var(--viewfinder-color), var(--viewfinder-color)) bottom
|
||||
left/var(--viewfinder-stroke) var(--viewfinder-length) no-repeat,
|
||||
linear-gradient(var(--viewfinder-color), var(--viewfinder-color)) bottom
|
||||
right/var(--viewfinder-length) var(--viewfinder-stroke) no-repeat,
|
||||
linear-gradient(var(--viewfinder-color), var(--viewfinder-color)) bottom
|
||||
right/var(--viewfinder-stroke) var(--viewfinder-length) no-repeat;
|
||||
}
|
||||
.a-viewfinder.a-in-frame::after {
|
||||
opacity: 1;
|
||||
inset: var(--viewfinder-selected-inset);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { storageGet, storageSet, storageRemove } from '$lib/storage';
|
||||
import { onMount } from 'svelte';
|
||||
import { toStore } from 'svelte/store';
|
||||
import { createMutation, createQuery, useQueryClient } from '@tanstack/svelte-query';
|
||||
@@ -47,18 +48,18 @@
|
||||
let chatCollapsed = $state(false);
|
||||
|
||||
$effect(() => {
|
||||
railCollapsed = localStorage.getItem(RAIL_KEY) === '1';
|
||||
chatCollapsed = localStorage.getItem(CHAT_KEY) === '1';
|
||||
railCollapsed = storageGet(RAIL_KEY) === '1';
|
||||
chatCollapsed = storageGet(CHAT_KEY) === '1';
|
||||
});
|
||||
|
||||
function toggleRail() {
|
||||
railCollapsed = !railCollapsed;
|
||||
localStorage.setItem(RAIL_KEY, railCollapsed ? '1' : '0');
|
||||
storageSet(RAIL_KEY, railCollapsed ? '1' : '0');
|
||||
}
|
||||
|
||||
function toggleChat() {
|
||||
chatCollapsed = !chatCollapsed;
|
||||
localStorage.setItem(CHAT_KEY, chatCollapsed ? '1' : '0');
|
||||
storageSet(CHAT_KEY, chatCollapsed ? '1' : '0');
|
||||
}
|
||||
|
||||
function isSceneSession(s: AgentSession): boolean {
|
||||
@@ -77,7 +78,7 @@
|
||||
if (shotStore.compositionId != null) await shotStore.flushSave();
|
||||
sessionId = id;
|
||||
compositionReady = false;
|
||||
if (persist) localStorage.setItem(ACTIVE_SESSION_KEY, String(id));
|
||||
if (persist) storageSet(ACTIVE_SESSION_KEY, String(id));
|
||||
const comp = await shotStore.loadComposition(id);
|
||||
if (comp && comp.title === 'Untitled composition') {
|
||||
const title = `Scene · ${id}`;
|
||||
@@ -106,7 +107,7 @@
|
||||
// (AI Canvas) excludes them, so the two surfaces never leak
|
||||
// into each other.
|
||||
const sessions = await agentApi.listSceneSessions();
|
||||
const stored = Number(localStorage.getItem(ACTIVE_SESSION_KEY) ?? '');
|
||||
const stored = Number(storageGet(ACTIVE_SESSION_KEY) ?? '');
|
||||
const sceneSessions = sessions.filter(isSceneSession);
|
||||
const initial = sceneSessions.find((s) => s.id === stored) ?? sceneSessions[0] ?? null;
|
||||
if (initial) {
|
||||
@@ -143,8 +144,8 @@
|
||||
const mine = comps.find((c) => c.agent_session_id === id);
|
||||
if (mine) await shotApi.deleteComposition(mine.id);
|
||||
await agentApi.deleteSession(id);
|
||||
if (Number(localStorage.getItem(ACTIVE_SESSION_KEY)) === id) {
|
||||
localStorage.removeItem(ACTIVE_SESSION_KEY);
|
||||
if (Number(storageGet(ACTIVE_SESSION_KEY)) === id) {
|
||||
storageRemove(ACTIVE_SESSION_KEY);
|
||||
}
|
||||
const sessions = await agentApi.listSceneSessions();
|
||||
const next = sessions.find(isSceneSession);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { resolve } from '$app/paths';
|
||||
import { storageGet } from '$lib/storage';
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { agentApi, canvasApi } from '$lib/api';
|
||||
@@ -10,7 +11,7 @@
|
||||
onMount(async () => {
|
||||
try {
|
||||
const sessions = await agentApi.listSessions();
|
||||
const stored = Number(localStorage.getItem('calliope.agents.activeSession'));
|
||||
const stored = Number(storageGet('calliope.agents.activeSession'));
|
||||
const found =
|
||||
sessions.find((s) => s.id === stored) ?? sessions[0] ?? (await agentApi.createSession({}));
|
||||
const graph = found.project_id
|
||||
|
||||
@@ -491,10 +491,14 @@
|
||||
// gone session just 404s in the session query, which is recoverable.
|
||||
activeId = pid;
|
||||
// Deep-link handoff (/agents?project=&task=) pre-fills the composer once.
|
||||
const prefill = sessionStorage.getItem('calliope.canvas.composerPrefill');
|
||||
if (prefill) {
|
||||
sessionStorage.removeItem('calliope.canvas.composerPrefill');
|
||||
setComposerDraft(prefill);
|
||||
try {
|
||||
const prefill = sessionStorage.getItem('calliope.canvas.composerPrefill');
|
||||
if (prefill) {
|
||||
sessionStorage.removeItem('calliope.canvas.composerPrefill');
|
||||
setComposerDraft(prefill);
|
||||
}
|
||||
} catch {
|
||||
// A blocked handoff cache must not interrupt opening the real session.
|
||||
}
|
||||
replaceUrlParam('session');
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
--agent-task-aurora-opacity: 0.6;
|
||||
--agent-duration-width: auto;
|
||||
--agent-duration-gap: 0px;
|
||||
--agent-footer-font: 11.5px;
|
||||
--agent-footer-font: 13px;
|
||||
--agent-art-meta-font: 11px;
|
||||
--agent-duration-bg: transparent;
|
||||
--agent-duration-font: var(--mono);
|
||||
@@ -128,6 +128,28 @@
|
||||
--desk-dock-focus:
|
||||
var(--sh-2), 0 0 0 3px color-mix(in srgb, var(--gold) 8%, transparent),
|
||||
0 0 40px color-mix(in srgb, var(--gold) 8%, transparent);
|
||||
--theme-pop-button-height: 26px;
|
||||
--theme-pop-button-padding: 9px;
|
||||
--theme-pop-button-size: 12px;
|
||||
--theme-pop-button-radius: 5px;
|
||||
--theme-pop-width: 380px;
|
||||
--theme-pop-left: calc(var(--rail) + 8px);
|
||||
--theme-pop-bottom: 12px;
|
||||
--theme-pop-shadow: var(--sh-2), 0 24px 60px rgba(0, 0, 0, 0.35);
|
||||
--theme-pop-header-gap: 8px;
|
||||
--theme-pop-header-padding: 12px 14px 8px;
|
||||
--theme-pop-body-padding: 4px 10px 10px;
|
||||
--theme-pop-footer-padding: 8px 10px 8px 14px;
|
||||
--theme-pop-title-size: 13.5px;
|
||||
--theme-pop-note-size: 11.5px;
|
||||
--theme-pop-footer-gap: 6px;
|
||||
--theme-choice-font: 400 13px/1.55 var(--font);
|
||||
--theme-choice-gap: 12px;
|
||||
--theme-choice-list-gap: 6px;
|
||||
--theme-choice-radius: 10px;
|
||||
--theme-choice-preview-radius: 8px;
|
||||
--theme-choice-english-font: 500 10.5px var(--mono);
|
||||
--theme-choice-description-line: 1.45;
|
||||
--theme-reveal-duration: 520ms;
|
||||
--theme-fallback-duration: 280ms;
|
||||
--theme-preview-art: linear-gradient(160deg, #2f5d7c, #f2b36b);
|
||||
@@ -163,6 +185,7 @@
|
||||
--manage-card-min: 280px;
|
||||
--manage-card-padding: 14px;
|
||||
/* Shared sample rail and management typography, not per-theme offsets. */
|
||||
--rail-background: var(--bg-1);
|
||||
--rail-padding: 12px 0 10px;
|
||||
--rail-brand-size: 40px;
|
||||
--rail-brand-margin: 10px;
|
||||
@@ -214,6 +237,33 @@
|
||||
--task-tabs-offset: 12px;
|
||||
--task-search-width: 240px;
|
||||
--task-preview-height: 300px;
|
||||
--viewfinder-color: color-mix(in srgb, var(--scene) 90%, var(--hi));
|
||||
--viewfinder-length: 12px;
|
||||
--viewfinder-stroke: 1.5px;
|
||||
--viewfinder-inset: -1px;
|
||||
--viewfinder-selected-inset: -3px;
|
||||
--desk-player-offset: -50%;
|
||||
--desk-media-bg: #000;
|
||||
--desk-media-radius: 8px;
|
||||
--desk-history-padding: 8px;
|
||||
--desk-history-gap: 8px;
|
||||
--desk-history-label-bg: rgba(0, 0, 0, 0.6);
|
||||
--desk-history-label-color: #ccc;
|
||||
--desk-empty-ring: 84px;
|
||||
--desk-empty-gap: 12px;
|
||||
--desk-empty-title-size: 14px;
|
||||
--desk-empty-hint-size: 12px;
|
||||
--desk-stage-background:
|
||||
radial-gradient(
|
||||
60% 70% at 50% 45%,
|
||||
color-mix(in srgb, var(--scene) var(--stage-tint), transparent),
|
||||
transparent 70%
|
||||
),
|
||||
repeating-linear-gradient(0deg, var(--scanline) 0 1px, transparent 1px 3px);
|
||||
--lattice-light-radius: 160px;
|
||||
--lattice-mask-end: 75%;
|
||||
--lattice-mask-radius: 140px;
|
||||
--lattice-scene: 30%;
|
||||
--desk-head-height: var(--head);
|
||||
--desk-head-inset: 16px;
|
||||
--desk-head-bg: var(--glass);
|
||||
@@ -277,6 +327,28 @@
|
||||
--t-base: 200ms;
|
||||
--t-slow: 320ms;
|
||||
--t-reveal: 700ms;
|
||||
--scan-duration: 1.6s;
|
||||
--lattice-duration: 320ms;
|
||||
--page-enter-y: 6px;
|
||||
--primary-sweep-width: 40%;
|
||||
--primary-sweep-from: -60%;
|
||||
--primary-sweep-to: 130%;
|
||||
--primary-sweep-skew: -20deg;
|
||||
--primary-sweep: linear-gradient(
|
||||
100deg,
|
||||
transparent,
|
||||
rgba(255, 255, 255, 0.55),
|
||||
transparent
|
||||
);
|
||||
--result-develop: a-develop;
|
||||
--scan-width: 45%;
|
||||
--generation-width: min(60%, 520px);
|
||||
--generation-max-height: 92%;
|
||||
--generation-radius: 8px;
|
||||
--generation-grain-opacity: 0.25;
|
||||
--generation-info-padding: 12px 14px;
|
||||
--generation-info-gap: 8px;
|
||||
--generation-info-bg: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
|
||||
/* layout */
|
||||
--rail: 68px;
|
||||
--list: 272px;
|
||||
@@ -349,6 +421,8 @@
|
||||
}
|
||||
|
||||
[data-theme="day"] {
|
||||
--viewfinder-color: color-mix(in srgb, var(--scene) 85%, black);
|
||||
--result-develop: a-develop-day;
|
||||
--project-button-disabled-filter: none;
|
||||
--project-button-disabled-bg: #e3ddd2;
|
||||
--project-button-disabled-color: #8d877d;
|
||||
@@ -437,6 +511,7 @@
|
||||
}
|
||||
|
||||
[data-theme="grade"] {
|
||||
--result-develop: a-develop-grade;
|
||||
--project-card-radius: 4px;
|
||||
--project-hero-radius: 4px;
|
||||
--project-eyebrow-radius: 3px;
|
||||
@@ -545,6 +620,7 @@
|
||||
}
|
||||
|
||||
[data-theme="bluehour"] {
|
||||
--rail-background: linear-gradient(180deg, #101a40, #1a1440);
|
||||
--project-shot-radius: 14px;
|
||||
--project-button-radius: 10px;
|
||||
--project-button-sm-radius: 8px;
|
||||
@@ -747,7 +823,9 @@
|
||||
--ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
|
||||
--d-press: 160ms;
|
||||
--d-state: 160ms;
|
||||
--d-pop: 180ms;
|
||||
--d-pop: var(--t-base);
|
||||
--pop-enter-y: 6px;
|
||||
--pop-enter-scale: 0.98;
|
||||
--d-leave: 200ms;
|
||||
--d-enter: 220ms;
|
||||
--d-drawer: 250ms;
|
||||
@@ -935,6 +1013,7 @@ html.theme-anim *::after {
|
||||
--agent-tool-radius: 4px;
|
||||
}
|
||||
[data-theme="bluehour"] {
|
||||
--rail-background: linear-gradient(180deg, #101a40, #1a1440);
|
||||
--agent-header-bg: color-mix(in srgb, #0f1838 55%, transparent);
|
||||
--agent-shot-radius: 14px;
|
||||
--agent-bubble-radius: 14px;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# HEL-733 · 全站既定动效修复与首轮差异核查
|
||||
|
||||
本卡尚未达到整站验收门槛。原样本的“克制”档缺少行为规则,需总管补充规范;不能用禁用该档宣布完成。当前交付是可审核的阶段代码、隔离复测和缺口清单,不合并、不部署,不请求用户整体验收。
|
||||
|
||||
基底为已集成B4的 `leefer/hel-731-studio-project@2952af42b6232483640f1f27803980367cd62dd0`,已核实远端与原PR #11合并状态。原HTML SHA256 `0473d80d22b90194375f3566c1b8ca30dbd7433581b18f60956eabca252242a4`。HEL-801批准的6项差异和hero小窗口例外保留。
|
||||
|
||||
## 实现
|
||||
|
||||
- `static/themes.css` 为新增/修正的视觉值统一来源;共享效果写在原 `app.css`,既有组件消费token,未引入样式覆盖层或项目依赖。
|
||||
- `AppShell` / `StudioDesk`:创作台使用自身页头,删除重复的48/44px全局顶栏;保留Ctrl+K、主题与真实队列入口。蓝调rail恢复原渐变;空态恢复样本84px环、标题与提示,舞台使用原场景光晕与扫描底纹,不放演示作品。
|
||||
- 统一页面320ms进入、蜂窝320ms径向跟随、取景框角标、扫描光1.6s、主按钮700ms扫光。既有减少动效规则归并为单一来源,系统或手动减少动效下关闭位移/循环/装饰。
|
||||
- `Artboard`:仅当前任务从pending/running到done时进行700ms主题显影;重复done快照不提前清除效果,历史/切主题不重播,点击可结束。生成层绑定真实running/pending状态;不修改任务来源、数值或业务逻辑。修复播放键按压时全局transform覆盖居中导致点击落空的问题,改用独立translate保持中心;视频默认暂停且只由用户操作播放。
|
||||
- `HistoryRail`:图片/视频按自身比例显示,编号覆盖在媒体上,复用统一取景框,移除强制方形缩略图;缺失/未完成保持明确占位。
|
||||
- 主题弹层复用`Modal`焦点、关闭和层级机制,原组件参数化定位与尺寸,恢复rail旁8px/底部12px/380px宽、四行预览与原文案。`ThemeChoices`仍复用设置页同一主题注册表,设置tiles形态保留。共用弹层修正为200ms、上移6px+缩放.98。
|
||||
- 智能体粒子在减少动效、任务页或隐藏标签页停止rAF,退出清理;B4成果底栏的存量11.5px容器字号改为样本13px,真实选择控件保留。
|
||||
- 画布入口、画布会话预填、搭景与原会话管理在浏览器local/sessionStorage禁止时使用既有安全封装或容错,避免页面抛错;缓存不可用不改变真实数据与会话归属。
|
||||
|
||||
## 进度条约4.6px核对
|
||||
|
||||
测量对象是第一行running任务的外框`.task-progress`和填充`i`,不是只看填充百分比。1440/1366/1280下原样本与实际x差分别为-4.9375/-4.640625/-4.296875,外框均156×4。
|
||||
|
||||
原样本第二行来源为“智能体 · 分镜助手”,隔离真实任务按契约显示“项目 · 雾港来信”,auto表格列宽随文本重新分配。只在参考DOM对应来源文字、不动CSS后,四主题三窗口外框与填充x/y/宽/高差均0。保留真实来源,未添加CSS偏移,不以base同样存在豁免。原HEL-772附件只有base-results,没有head-results;本轮提供当前基底重新实测、输入和DOM,不声称读到了缺失文件。
|
||||
|
||||
## 复现与验证边界
|
||||
|
||||
先`npm --prefix calliope-web ci`,执行lint/check/test/build。浏览器验证需要运行环境已有的Playwright和Chromium;不加入项目依赖。`e2e/hel733-audit.mjs`读取冻结build、原HTML与明确隔离输入,阻止外部请求和产品写操作;样本从任务附件下载到仓库父目录`materials`。完整输入与产物在本卡证据附件中。
|
||||
|
||||
`e2e/run-hel733.py`使用真实隔离后端、假ComfyUI、假智能体模型和冻结build的preview服务。测试与构建顺序执行,避免开发服务器被check/build生成文件热重载而污染交互记录。退出核对daemon PID,关闭所有自建进程并删除隔离数据库;保留截图、结果与录屏。可用`HEL733_TESTS`指定脚本列表。
|
||||
|
||||
初审96组覆盖8页×四主题×三窗口;真实隔离数据截图另覆盖12类页面。大部分原样本是演示内容,应用截图是真实隔离API状态/空态,不能把这些自动称为全站同状态像素通过。B4的24组已有内容映射由`hel732-visual.cjs`另行核对。具体数表、命令、结果、录屏和未覆盖项见本卡附件。
|
||||
|
||||
## 未完成门槛
|
||||
|
||||
1. “克制”需要各类循环、位移/滤镜、时长/曲线、打断及系统优先规则;原HTML1137行只有选项,1532/1605行脚本只支持reduce,v1/v2也未补规则,不自行创作第三套动效。
|
||||
2. 全站各真实/空态与交互态的完整同状态映射、逐页目检、所有关键数值表尚未全部收齐,初审图不能代替差异清零。
|
||||
3. HEL-767既有末槽“导航”与原样本“规范”用途不同,需总管核定,不把几何一致视为新增授权。画布/搭景原样本仅组织说明,缺精确画面处不自创。
|
||||
4. 未验证真实GPU/收费模型质量、线上真实用户数据和独立部署;由总管后续安排总工审核与部署。
|
||||
|
||||
回退本轮代码可revert本卡提交,保留2952af4与全部B4修复;零后端/数据库结构改动,无部署/迁移需回退。
|
||||
|
||||
## 本轮最终自测结果
|
||||
|
||||
- 全仓`npm run lint`、`npm run check`(0 errors / 0 warnings)、`npm test`、`npm run build`通过;保留现有构建chunk/第三方未使用导入提示,无新增检查例外。
|
||||
- 冻结构建+真实隔离API:新增浏览器187项通过、0 pageerror;涵盖四主题显影/扫描、真实鼠标播放、首尾帧上传与编辑器实例保留、会话草稿、粒子停止、local/sessionStorage禁止。
|
||||
- B4功能31项通过;同状态24组,156对关键DOM值0差异,另4项交互通过。原验证脚本中开发时动态导入源模块改为点击实际主题入口,现可审核冻结产物。
|
||||
- 96组逐页初审图、144张真实隔离页面图、12组主题弹层;弹层外框四主题三窗口x/y/宽/高差均0。全动效下12组蜂窝背景/遮罩/透明度/时序/层级均与原件一致。
|
||||
- 以上不替代未完成门槛;没有把真实数据差异、缺样本或克制禁用归类为整站通过。
|
||||
@@ -53,7 +53,7 @@ const style=loc=>loc.evaluate(e=>{const s=getComputedStyle(e),r=e.getBoundingCli
|
||||
await a.screenshot({path:`${out}/task-${theme}-${width}-actual.png`,animations:'disabled'});await s.screenshot({path:`${out}/task-${theme}-${width}-reference-content.png`,animations:'disabled'});
|
||||
for(const [name,actual,ref] of [['columns','.atask','.atask'],['artifact','.artifact','.artifact'],['header','.art-h','.art-h'],['footer','.art-f','.art-f'],['shot','.shot','.shot'],['save','.art-f .secondary','.art-f .btn:not(.primary)'],['primary','.art-f .primary','.art-f .primary']])rows.push({theme,width,height,page:'task',name,actual:await style(a.locator(actual).first()),sample:await style(s.locator(ref).first())});
|
||||
if(width===1440&&theme==='night'){
|
||||
await a.getByLabel('镜头 b4-shot-1 描述').fill('主题切换保持未保存编辑');await a.evaluate(async()=>{const {setTheme}=await import('/src/lib/theme.ts');setTheme('day')});await a.waitForFunction(()=>document.documentElement.dataset.theme==='day');assert.equal(await a.getByLabel('镜头 b4-shot-1 描述').inputValue(),'主题切换保持未保存编辑');operations.push('切换主题保持未保存成果文本');await a.screenshot({path:out+'/operation-theme-edit-preserved.png'});
|
||||
await a.getByLabel('镜头 b4-shot-1 描述').fill('主题切换保持未保存编辑');await a.locator('.sidebar-bottom button[title="主题"]').click();await a.locator('.choices.compact .choice').filter({hasText:'日光棚'}).click();await a.keyboard.press('Escape');await a.waitForTimeout(600);await a.waitForFunction(()=>document.documentElement.dataset.theme==='day');assert.equal(await a.getByLabel('镜头 b4-shot-1 描述').inputValue(),'主题切换保持未保存编辑');operations.push('切换主题保持未保存成果文本');await a.screenshot({path:out+'/operation-theme-edit-preserved.png'});
|
||||
await a.getByRole('button',{name:'原文',exact:true}).click();await a.waitForFunction(()=>document.querySelector('[aria-label=成果草稿]')?.value.includes('主题切换保持未保存编辑'));assert((await a.getByLabel('成果草稿').inputValue()).includes('主题切换保持未保存编辑'));operations.push('逐镜编辑与原文视图同步');await a.screenshot({path:out+'/operation-raw-edit.png'});
|
||||
await a.reload();await a.locator('.shot-copy textarea').first().waitFor();await a.getByRole('button',{name:'对比上一版',exact:true}).click();await a.getByRole('dialog').waitFor();await a.screenshot({path:out+'/operation-version-comparison.png'});await a.keyboard.press('Escape');
|
||||
const tool=a.locator('.tool-card .head').first();await tool.click();await a.locator('.tool-card .body').first().waitFor();operations.push('工具详情真实参数与返回值可展开');await a.screenshot({path:out+'/operation-tool-expanded.png'});
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
// Foreground static-build audit. All API reads use labelled, isolated inputs;
|
||||
// all non-local requests and all product mutations are blocked.
|
||||
import fs from 'node:fs/promises';
|
||||
import http from 'node:http';
|
||||
import path from 'node:path';
|
||||
const { chromium } = await import(process.env.PLAYWRIGHT_MODULE || 'playwright');
|
||||
const out = process.env.HEL733_OUT || '../evidence/hel733/before';
|
||||
await fs.mkdir(out, { recursive: true });
|
||||
const fixture = JSON.parse(await fs.readFile('../evidence/hel733/fixtures.json'));
|
||||
const sample = await fs.readFile('../materials/夜片场-多主题交互样本.html');
|
||||
const log = { errors: [], blocked: [], rows: [], requests: [] };
|
||||
const server = http.createServer(async (req, res) => {
|
||||
try {
|
||||
const p = decodeURIComponent(new URL(req.url, 'http://local').pathname);
|
||||
if (p === '/sample') { res.setHeader('Content-Type','text/html;charset=utf-8'); return res.end(sample); }
|
||||
let file = path.join('calliope-web/build', p);
|
||||
if (!path.extname(file)) file = 'calliope-web/build/index.html';
|
||||
res.setHeader('Content-Type', file.endsWith('.js') ? 'text/javascript' : file.endsWith('.css') ? 'text/css' : 'text/html');
|
||||
res.end(await fs.readFile(file));
|
||||
} catch { res.writeHead(404); res.end(); }
|
||||
});
|
||||
await new Promise(r => server.listen(0,'127.0.0.1',r));
|
||||
const base = `http://127.0.0.1:${server.address().port}`;
|
||||
const browser = await chromium.launch({args:['--no-sandbox']});
|
||||
const measure = (p, selectors) => p.evaluate(selectors => Object.fromEntries(Object.entries(selectors).map(([key,sel]) => {
|
||||
const e=document.querySelector(sel); if(!e) return [key,null];
|
||||
const r=e.getBoundingClientRect(),c=getComputedStyle(e);
|
||||
return [key,{x:r.x,y:r.y,width:r.width,height:r.height,...Object.fromEntries(['fontSize','fontWeight','lineHeight','letterSpacing','backgroundColor','backgroundImage','borderRadius','color','padding','boxSizing','animationName','animationDuration'].map(k=>[k,c[k]]))}];
|
||||
})),selectors);
|
||||
try {
|
||||
const c=await browser.newContext();
|
||||
await c.addInitScript(()=>{
|
||||
localStorage.setItem('aigc-lang','zh');localStorage.setItem('aigc-reduce-motion','1');
|
||||
window.__sse=[];window.EventSource=class{constructor(){window.__sse.push(this);setTimeout(()=>this.onopen?.(),0)}addEventListener(t,f){(this.handlers??={})[t]=f}close(){}};
|
||||
});
|
||||
await c.route('**/*',async route=>{
|
||||
const req=route.request(),u=new URL(req.url());
|
||||
if(['data:','blob:'].includes(u.protocol))return route.continue();
|
||||
if(u.origin!==base){log.blocked.push(req.url());return route.abort()}
|
||||
if(!u.pathname.startsWith('/api/'))return route.continue();
|
||||
log.requests.push([req.method(),u.pathname]);
|
||||
if(req.method()!=='GET')return route.fulfill({status:403,body:'Isolated audit blocks mutations'});
|
||||
const p=u.pathname;let body=[];
|
||||
if(p==='/api/settings')body={comfyui_endpoints:[],llm_profiles:[],queue_concurrency:2,queue_poll_timeout_sec:1800,queue_poll_interval_sec:1,queue_max_retries:1,data_dir:'HEL733 isolated audit',dry_run:false};
|
||||
if(p==='/api/jobs')body=u.searchParams.get('empty')?[]:fixture.jobs;
|
||||
if(p==='/api/workflows')body=fixture.workflows;
|
||||
if(p==='/api/projects')body=[{id:1,title:'雾港来信'}];
|
||||
if(p==='/api/jobs/queue-status')body={paused:false};
|
||||
if(p==='/api/comfyui/endpoints')body={endpoints:[],active_id:null};
|
||||
if(p==='/api/agent/sessions')body=[];
|
||||
if(p==='/api/agent/agents')body=[];
|
||||
if(/^\/api\/workflows\/\d+$/.test(p))body={...fixture.workflows.find(x=>x.id===+p.split('/').pop()),workflow_json:{}};
|
||||
if(p==='/api/file')return route.fulfill({status:404,body:'No audit media'});
|
||||
return route.fulfill({json:body});
|
||||
});
|
||||
const a=await c.newPage(),s=await c.newPage();a.on('pageerror',e=>log.errors.push(e.message));
|
||||
await s.goto(base+'/sample');await s.evaluate(()=>document.documentElement.classList.add('capture','reduce'));
|
||||
const pages=process.env.HEL733_CREATE_ONLY ? [['create','create']] : process.env.HEL733_POP_ONLY ? [['settings','settings']] : process.env.HEL733_TASKS_ONLY ? [['tasks','tasks']] : [['','studio'],['create','create'],['agents','agents'],['workflows','workflows'],['connections','models'],['tasks','tasks'],['library','library'],['settings','settings']];
|
||||
for(const [width,height] of [[1440,900],[1366,768],[1280,720]])for(const theme of ['night','day','grade','bluehour'])for(const [route,ref] of pages){
|
||||
await a.setViewportSize({width,height});await s.setViewportSize({width,height});
|
||||
await a.goto(base+'/'+route);await a.locator('aside.sidebar').waitFor();
|
||||
await a.evaluate(t=>{document.documentElement.dataset.theme=t;window.dispatchEvent(new StorageEvent('storage',{key:'aigc-theme',newValue:t}));for(const es of window.__sse)for(const [id,progress] of [[1,62],[2,35]])es.handlers?.['job.progress']?.({data:JSON.stringify({type:'job.progress',data:{job_id:id,progress}})})},theme);
|
||||
await s.evaluate(({ref,theme})=>{go(ref);renderTasks();document.documentElement.dataset.theme=theme;document.querySelector('#motionBtn span').textContent='动效关'},{ref,theme});
|
||||
await a.waitForTimeout(400);
|
||||
const as={rail:'aside.sidebar',brand:'aside.sidebar .brand',nav:'aside.sidebar nav a',divider:'aside.sidebar hr',queue:'.queue-dot',theme:'.sidebar-bottom button',settings:'.sidebar-bottom a[href="/settings"]',header:'.management-header, .studio-header, .studio-heading, .desk-head, .topbar',progress:'.task-progress',fill:'.task-progress i'};
|
||||
const ss={rail:'.rail',brand:'.rail .brand',nav:'.rail>.nav',divider:'.rail hr',queue:'.rail .queue-dot',theme:'#themeBtn',settings:'.rail [data-go="settings"]',header:`#p-${ref} .ph`,progress:'#taskTable .bar',fill:'#taskTable .bar i'};
|
||||
if(route==='create'){
|
||||
Object.assign(as,{title:'.model-selector',primary:'.dock .gen',prompt:'#desk-prompt',workspace:'.reference-desk'});
|
||||
Object.assign(ss,{title:'#hdName',primary:'#genBtn',prompt:'#posTa',workspace:'#p-create .create'});
|
||||
}else if(route==='agents'){
|
||||
Object.assign(as,{title:'.ahero h2',primary:'.big-input .primary',prompt:'.big-input textarea'});
|
||||
Object.assign(ss,{title:'#p-agents .ahero h2',primary:'#p-agents .big-input .primary',prompt:'#p-agents .big-input textarea'});
|
||||
}else if(['workflows','connections','tasks','library','settings'].includes(route)){
|
||||
Object.assign(as,{title:'.management-header > b',primary:'.management-header .a-btn, .a-btn.primary',search:'.mg-search',input:'.mg-input, .field-input'});
|
||||
Object.assign(ss,{title:`#p-${ref} .ph b`,primary:`#p-${ref} .ph .btn, #p-${ref} .btn.primary`,search:`#p-${ref} .ph .input`,input:`#p-${ref} .input`});
|
||||
}
|
||||
const name=`${route||'studio'}-${theme}-${width}`;
|
||||
const row={route:route||'studio',ref,theme,width,height,actual:await measure(a,as),sample:await measure(s,ss)};
|
||||
if(route==='tasks'){
|
||||
row.actualTable=await a.locator('.task-table table').evaluate(e=>({columns:[...e.rows[1].cells].map(c=>({text:c.innerText,width:c.getBoundingClientRect().width,x:c.getBoundingClientRect().x,style:getComputedStyle(c).cssText})),html:e.outerHTML}));
|
||||
row.sampleTable=await s.locator('#p-tasks table').evaluate(e=>({columns:[...e.rows[1].cells].map(c=>({text:c.innerText,width:c.getBoundingClientRect().width,x:c.getBoundingClientRect().x})),html:e.outerHTML}));
|
||||
}
|
||||
if(route==='tasks'){
|
||||
const sources=await a.locator('.task-table tbody tr td:nth-child(3)').allTextContents();
|
||||
await s.evaluate(sources=>{document.querySelectorAll('#taskTable tr').forEach((r,i)=>r.cells[2].textContent=sources[i])},sources);
|
||||
row.sameSourceSample=await measure(s,{progress:'#taskTable .bar',fill:'#taskTable .bar i'});
|
||||
}
|
||||
log.rows.push(row);
|
||||
if(route==='create') {
|
||||
await a.evaluate(()=>document.documentElement.dataset.reduce='0');await s.evaluate(()=>document.documentElement.classList.remove('reduce'));
|
||||
await a.locator('.workflow-row').first().hover({position:{x:40,y:20}});
|
||||
await s.locator('#wfList .wfi').first().hover({position:{x:40,y:20}});
|
||||
const pointer=await a.locator('.workflow-row').first().evaluate(e=>({x:e.style.getPropertyValue('--pointer-x'),y:e.style.getPropertyValue('--pointer-y')}));
|
||||
await s.locator('#wfList .wfi').first().evaluate((e,p)=>{e.style.setProperty('--mx',p.x);e.style.setProperty('--my',p.y)},pointer);
|
||||
row.hoverInput={mode:'full',pointer};
|
||||
await a.waitForTimeout(350);
|
||||
const pseudo=(p,sel,which)=>p.locator(sel).first().evaluate((e,which)=>{const c=getComputedStyle(e,which);return Object.fromEntries(['backgroundImage','maskImage','opacity','transitionDuration','transitionTimingFunction','zIndex'].map(k=>[k,c[k]]))},which);
|
||||
row.hoverActual=await pseudo(a,'.workflow-row','::after');row.hoverSample=await pseudo(s,'#wfList .wfi','::before');
|
||||
await a.mouse.move(0,0);await s.mouse.move(0,0);await a.waitForTimeout(350);await a.evaluate(()=>document.documentElement.dataset.reduce='1');await s.evaluate(()=>document.documentElement.classList.add('reduce'));
|
||||
}
|
||||
if(route==='settings') {
|
||||
await a.locator('.sidebar-bottom button[title="主题"]').click();
|
||||
await s.evaluate(()=>document.querySelector('#themePop').classList.add('on'));
|
||||
await a.waitForTimeout(400);
|
||||
row.themePopActual=await measure(a,{panel:'.modal-panel',row:'.choices.compact .choice',preview:'.choices.compact .preview'});
|
||||
row.themePopSample=await measure(s,{panel:'#themePop',row:'.topt',preview:'.topt .tprev'});
|
||||
await a.screenshot({path:`${out}/${name}-theme-pop-actual.png`});await s.screenshot({path:`${out}/${name}-theme-pop-sample.png`});
|
||||
await a.keyboard.press('Escape');await s.evaluate(()=>document.querySelector('#themePop').classList.remove('on'));
|
||||
}
|
||||
await a.screenshot({path:`${out}/${name}-actual.png`,animations:'disabled'});await s.screenshot({path:`${out}/${name}-sample.png`,animations:'disabled'});
|
||||
console.log(name);
|
||||
}
|
||||
await c.close();
|
||||
}finally{await fs.writeFile(out+'/results.json',JSON.stringify(log,null,2));await browser.close();await new Promise(r=>server.close(r));}
|
||||
@@ -0,0 +1,86 @@
|
||||
// Real isolated API and fake ComfyUI; never connects to production.
|
||||
const {chromium}=require(process.env.PLAYWRIGHT_MODULE_PATH||'playwright');
|
||||
const fs=require('node:fs'),assert=require('node:assert/strict'),path=require('node:path');
|
||||
const OUT='../evidence/hel733/live',WEB='http://127.0.0.1:5173',API='http://127.0.0.1:8247';
|
||||
fs.mkdirSync(OUT,{recursive:true});
|
||||
const checks=[],errors=[],ok=(name,value)=>{checks.push({name,pass:!!value});assert(value,name);console.log('PASS',name)};
|
||||
const api=async p=>(await fetch(API+p)).json();
|
||||
const wait=ms=>new Promise(r=>setTimeout(r,ms));
|
||||
(async()=>{
|
||||
const b=await chromium.launch({executablePath:process.env.CHROMIUM_EXECUTABLE_PATH,args:['--no-sandbox']});
|
||||
try{
|
||||
const f=JSON.parse(fs.readFileSync('e2e/shots/reference/fixtures.json'));
|
||||
const state=JSON.parse(fs.readFileSync('e2e/shots/hel732/fixture-state.json'));
|
||||
const c=await b.newContext({viewport:{width:1440,height:900},recordVideo:{dir:OUT+'/recordings'}});
|
||||
await c.addInitScript(()=>{
|
||||
window.mediaCalls=[];
|
||||
for(const method of ['play','pause']){const original=HTMLMediaElement.prototype[method];HTMLMediaElement.prototype[method]=function(...args){window.mediaCalls.push({method,src:this.src,stack:new Error().stack});const result=original.apply(this,args);result?.catch?.(e=>window.mediaCalls.push({method,error:e.message}));return result}}
|
||||
window.arrivalEvents=[];document.addEventListener('animationstart',e=>window.arrivalEvents.push({name:e.animationName,time:performance.now()}),true);
|
||||
const clear=CanvasRenderingContext2D.prototype.clearRect;
|
||||
window.particleFrames=0;CanvasRenderingContext2D.prototype.clearRect=function(...args){if(this.canvas.classList.contains('particles'))window.particleFrames++;return clear.apply(this,args)};
|
||||
});
|
||||
const p=await c.newPage();p.setDefaultTimeout(15000);p.on('pageerror',e=>errors.push(e.message));
|
||||
for(const theme of (process.env.HEL733_SKIP_EFFECTS?[]:['night','day','grade','bluehour'])){
|
||||
await p.goto(WEB+'/create?wf='+f.dual);
|
||||
await p.locator('#desk-prompt').fill('HEL733 '+theme+' 状态保留与显影');
|
||||
await p.evaluate(t=>{document.documentElement.dataset.theme=t;window.dispatchEvent(new StorageEvent('storage',{key:'aigc-theme',newValue:t}));localStorage.setItem('aigc-reduce-motion','0')},theme);
|
||||
await wait(400);
|
||||
ok(theme+' creative header starts at y=0 without duplicate global bar',await p.locator('.studio-heading').evaluate(e=>e.getBoundingClientRect().y===0));
|
||||
fs.writeFileSync('e2e/fake_mode.json',JSON.stringify({mode:'ok',delay_sec:4,unique_filename:true,image_file:path.resolve('calliope-web/static/refract/coast.jpg')}));
|
||||
await p.locator('.gen').click();await p.locator('.a-scan-beam').waitFor();
|
||||
const scan=await p.locator('.a-scan-beam').evaluate(e=>{const c=getComputedStyle(e);return [c.animationName,c.animationDuration]});
|
||||
ok(theme+' scan 1.6s',scan[0]==='a-scan'&&scan[1]==='1.6s');await p.screenshot({path:OUT+'/'+theme+'-generating.png'});
|
||||
try{await p.waitForFunction(()=>window.arrivalEvents.some(x=>x.name.startsWith('a-develop')),null,{timeout:30000})}catch(e){fs.writeFileSync(OUT+'/arrival-failure.json',JSON.stringify({theme,events:await p.evaluate(()=>window.arrivalEvents),jobs:await api('/api/playground/jobs'),dom:await p.locator('.preview-area').innerHTML()},null,2));throw e}
|
||||
const events=await p.evaluate(()=>window.arrivalEvents);ok(theme+' correct development variant',events.some(x=>x.name===({day:'a-develop-day',grade:'a-develop-grade'}[theme]||'a-develop')));
|
||||
await p.locator('.a-result-develop').first().dispatchEvent('pointerdown').catch(()=>{});await p.waitForTimeout(800);ok(theme+' development class clears after completion',await p.locator('.a-result-develop').count()===0);
|
||||
const before=await p.locator('#desk-prompt').inputValue();
|
||||
await p.locator('.sidebar-bottom button[title="主题"]').click();await p.locator('.choices .choice').filter({hasText:'日光棚'}).first().click();await wait(650);
|
||||
ok(theme+' theme keeps prompt, workflow and result',(await p.locator('#desk-prompt').inputValue())===before&&(await p.locator('.print img').count())===1&&new URL(p.url()).searchParams.get('wf')===String(f.dual));
|
||||
ok(theme+' theme does not replay result arrival',await p.locator('.a-result-develop').count()===0);await p.keyboard.press('Escape');
|
||||
}
|
||||
await p.goto(WEB+'/create?kind=video&wf='+f.h3);
|
||||
await p.locator('#desk-prompt').fill('HEL733 video upload state');
|
||||
await p.getByRole('button',{name:'管理素材',exact:true}).click();
|
||||
for(const [label,file] of [['首帧','coast.jpg'],['尾帧','arch.jpg']]){
|
||||
const slot=p.locator('.a-slot').filter({has:p.getByText(label,{exact:true})});
|
||||
await slot.locator('input[type=file]').setInputFiles('calliope-web/static/refract/'+file);await slot.locator('img').waitFor();
|
||||
}
|
||||
await p.getByRole('button',{name:'完成',exact:true}).click();
|
||||
await p.locator('#desk-prompt').evaluate(e=>window.hel733Editor=e);
|
||||
const uploads=await p.locator('.media-token img').evaluateAll(es=>es.map(e=>e.src));
|
||||
for(const name of ['夜片场','日光棚','调色间','蓝调时刻']){
|
||||
await p.locator('.sidebar-bottom button[title="主题"]').click();await p.locator('.choices.compact .choice').filter({hasText:name}).click();await wait(600);await p.keyboard.press('Escape');
|
||||
ok(name+' theme retains live editor, uploads and workflow',await p.locator('#desk-prompt').evaluate(e=>e===window.hel733Editor)&&JSON.stringify(await p.locator('.media-token img').evaluateAll(es=>es.map(e=>e.src)))===JSON.stringify(uploads)&&new URL(p.url()).searchParams.get('wf')===String(f.h3));
|
||||
}
|
||||
fs.writeFileSync('e2e/fake_mode.json',JSON.stringify({mode:'ok',videos:true,delay_sec:1,unique_filename:true}));
|
||||
await p.locator('.gen').click();const video=p.locator('.print video');await video.waitFor();await p.waitForFunction(()=>document.querySelector('.print video')?.readyState>=1);
|
||||
ok('new video remains paused',await video.evaluate(e=>e.paused&&!e.autoplay));await video.evaluate(e=>{window.videoEvents=[];for(const name of ['play','playing','pause','error','ended'])e.addEventListener(name,()=>window.videoEvents.push({name,time:e.currentTime,error:e.error?.message}));});await p.locator('.big-play').click();await wait(500);fs.writeFileSync(OUT+'/video-diagnostics.json',JSON.stringify(await video.evaluate(e=>({events:window.videoEvents,calls:window.mediaCalls,src:e.src,paused:e.paused,ready:e.readyState,network:e.networkState,error:e.error?.message,codec:e.canPlayType('video/mp4; codecs="avc1.42E01E"')})),null,2));await p.waitForFunction(()=>!document.querySelector('.print video').paused);ok('video plays only on explicit action',await video.evaluate(e=>!e.paused));await video.evaluate(e=>e.pause());
|
||||
if(process.env.HEL733_VIDEO_ONLY){await c.close();return}
|
||||
await p.goto(WEB+'/agents?session='+state.board);await p.locator('.shot-copy textarea').first().fill('HEL733 unsaved session draft');
|
||||
const sessionUrl=p.url();await p.locator('.sidebar-bottom button[title="主题"]').click();await p.locator('.choices.compact .choice').filter({hasText:'日光棚'}).click();await wait(600);await p.keyboard.press('Escape');
|
||||
ok('theme keeps session and unsaved result',(await p.locator('.shot-copy textarea').first().inputValue())==='HEL733 unsaved session draft'&&p.url()===sessionUrl);
|
||||
await p.goto(WEB+'/agents');await p.locator('canvas.particles').waitFor();await wait(150);
|
||||
const full=await p.evaluate(()=>window.particleFrames);await wait(150);ok('particles advance in full mode',(await p.evaluate(()=>window.particleFrames))>full);
|
||||
await p.locator('.sidebar-bottom button[title="主题"]').click();await p.locator('.theme-motion button').click();await wait(100);const reduced=await p.evaluate(()=>window.particleFrames);await wait(200);
|
||||
ok('manual reduce stops particle rAF',(await p.evaluate(()=>window.particleFrames))===reduced);await p.keyboard.press('Escape');
|
||||
await p.emulateMedia({reducedMotion:'reduce'});ok('system reduce is mirrored on root',await p.locator('html').getAttribute('data-reduce')==='1');
|
||||
await p.goto(WEB+'/settings');await p.locator('.management-header').waitFor();ok('system reduce disables motion override',await p.locator('html').getAttribute('data-reduce')==='1');
|
||||
await p.emulateMedia({reducedMotion:'no-preference'});
|
||||
// All real API data / actual empty states. Reference equivalence is a separate audit.
|
||||
for(const [width,height] of (process.env.HEL733_SKIP_SHOTS ? [] : [[1440,900],[1366,768],[1280,720]]))for(const theme of ['night','day','grade','bluehour'])for(const [name,route] of [['studio','/'],['image','/create?wf='+f.dual],['video','/create?kind=video'],['agents','/agents'],['agent-task','/agents?session='+state.board],['project','/workbench/'+state.project.id+'?stage=storyboard'],['workflows','/workflows'],['models','/model-connections'],['tasks','/tasks'],['library','/library'],['settings','/settings'],['canvas','/canvas']]){
|
||||
await p.setViewportSize({width,height});await p.goto(WEB+route);await p.waitForTimeout(name==='canvas'?800:200);
|
||||
await p.evaluate(t=>{document.documentElement.dataset.theme=t;window.dispatchEvent(new StorageEvent('storage',{key:'aigc-theme',newValue:t}))},theme);
|
||||
await p.screenshot({path:`${OUT}/${name}-${theme}-${width}.png`});
|
||||
ok(`${name} ${theme} ${width} body renders`,(await p.locator('body').innerText()).trim().length>0);
|
||||
}
|
||||
await c.close();
|
||||
const blocked=await b.newContext({viewport:{width:1440,height:900}});
|
||||
await blocked.addInitScript(()=>{Storage.prototype.getItem=()=>{throw new DOMException('blocked','SecurityError')};Storage.prototype.setItem=()=>{throw new DOMException('blocked','SecurityError')}});
|
||||
const q=await blocked.newPage();q.on('pageerror',e=>errors.push(q.url()+' '+e.stack));
|
||||
for(const route of ['/create?wf='+f.dual,'/agents','/settings','/canvas','/build-scene','/agents?legacy=1']){
|
||||
await q.goto(WEB+route);await q.waitForTimeout(800);ok('storage blocked '+route+' remains usable',await q.locator('.refract-shell, .canvas-layout, .flow-canvas').count()>0||!(await q.locator('.redirect-error').count()));
|
||||
}
|
||||
await q.goto(WEB+'/settings');await q.locator('.choices.tiles .choice').filter({hasText:'日光棚'}).click();await wait(650);ok('storage blocked theme changes',await q.locator('html').getAttribute('data-theme')==='day');
|
||||
await q.screenshot({path:OUT+'/storage-blocked.png'});await blocked.close();ok('no browser page errors',errors.length===0);
|
||||
}finally{fs.writeFileSync(OUT+'/results.json',JSON.stringify({checks,errors},null,2));await b.close()}
|
||||
})().catch(e=>{console.error(e);process.exitCode=1});
|
||||
@@ -0,0 +1,57 @@
|
||||
"""Run the isolated regression stack in the foreground and always stop children."""
|
||||
import os, signal, socket, subprocess, time, urllib.request
|
||||
from pathlib import Path
|
||||
root=Path(__file__).resolve().parents[1]
|
||||
os.chdir(root)
|
||||
py=os.environ.get('HEL732_PYTHON', 'python3')
|
||||
logs=root/'e2e/shots/hel732'; logs.mkdir(parents=True,exist_ok=True)
|
||||
env=os.environ.copy()
|
||||
env['PYTHONPATH']=str(root/'calliope-backend/src')
|
||||
for port in [8247,5173,18188,18189]:
|
||||
with socket.socket() as probe:
|
||||
assert probe.connect_ex(('127.0.0.1',port)) != 0, f'Test port {port} is already in use'
|
||||
# Every run gets fresh disposable state; retain prior evidence instead of deleting it.
|
||||
reference=root/'e2e/shots/reference'
|
||||
reuse_fixture=os.environ.get('HEL732_REUSE_FIXTURE')=='1'
|
||||
if reference.exists() and not reuse_fixture:reference.rename(reference.with_name('reference.previous-'+str(time.time_ns())))
|
||||
mode_path=root/'e2e/fake_mode.json'
|
||||
saved_mode=mode_path.read_bytes() if mode_path.exists() else None
|
||||
processes=[]; handles=[]
|
||||
try:
|
||||
for name,cmd in [('api',[py,'e2e/reference/server.py']),('comfy',[py,'e2e/fake_comfy.py']),('llm',[py,'e2e/fake_agent_b4.py']),('web',['npm','--prefix',os.environ.get('HEL732_WEB_DIR',os.environ.get('HEL729_WEB_DIR','calliope-web')),'run','preview','--','--host','127.0.0.1','--port','5173'])]:
|
||||
h=open(logs/(name+'.log'),'w');handles.append(h);processes.append(subprocess.Popen(cmd,stdout=h,stderr=subprocess.STDOUT,env=env,start_new_session=True))
|
||||
for url in ['http://127.0.0.1:8247/api/health','http://127.0.0.1:5173']:
|
||||
for i in range(100):
|
||||
try:
|
||||
urllib.request.urlopen(url,timeout=2); break
|
||||
except Exception:
|
||||
if any(p.poll() is not None for p in processes): raise RuntimeError('A test service failed')
|
||||
if i==99:raise
|
||||
time.sleep(.2)
|
||||
if not reuse_fixture:
|
||||
for cmd in [[py,'e2e/seed.py'],[py,'e2e/reference/seed.py']]:subprocess.run(cmd,env=env,check=True)
|
||||
failures=[]
|
||||
scripts=os.environ.get('HEL733_TESTS','e2e/hel732.cjs,e2e/hel733-live.cjs').split(',')
|
||||
for script in scripts:
|
||||
print('RUN',script,flush=True)
|
||||
result=subprocess.run(['node',script],env=env)
|
||||
if result.returncode:failures.append(script)
|
||||
print('FAILED SCRIPTS',failures,flush=True)
|
||||
if failures:raise SystemExit(1)
|
||||
|
||||
finally:
|
||||
import json
|
||||
daemon_pid=json.loads(subprocess.check_output(['multica','daemon','status','--output','json']))['pid']
|
||||
assert all(p.pid != daemon_pid for p in processes)
|
||||
for p in processes:
|
||||
if p.poll() is None:os.killpg(p.pid,signal.SIGTERM)
|
||||
for p in processes:
|
||||
try:p.wait(timeout=10)
|
||||
except subprocess.TimeoutExpired:os.killpg(p.pid,signal.SIGKILL);p.wait()
|
||||
print("STOPPED TEST CHILDREN", [{"pid":p.pid,"exit":p.returncode} for p in processes],flush=True)
|
||||
for h in handles:h.close()
|
||||
|
||||
import shutil
|
||||
if reference.exists():shutil.rmtree(reference)
|
||||
if saved_mode is not None:mode_path.write_bytes(saved_mode)
|
||||
elif mode_path.exists():mode_path.unlink()
|
||||
Reference in New Issue
Block a user