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;
|
||||
|
||||
Reference in New Issue
Block a user