Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/guides/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ The first launch creates an untitled canvas. Later launches can restore the most
- Click the project name at the top left to rename it. Press `Enter` or click elsewhere to save, or press `Esc` to cancel.
- Click the arrow next to the name to switch projects. Choose **New canvas project** to create one.
- On an empty canvas, click **Configure models** to open **Settings → Model connections**.
- Click **Try the example canvas** to pick a hosted sample. The picker lists the samples it can reach; choosing one downloads it, imports it as a new project and opens it. A download that is a ZIP around a single `.canvas` file is unwrapped automatically, and a page returned instead of a file is reported rather than imported. If the download fails, use the row's **Import manually** link, then drop the `.canvas` file on the canvas.
- Use the left toolbar or double-click empty canvas space to create text, image, video, audio, timeline, or subject nodes.
- Right-click empty canvas space to create a node, paste, undo, or redo.
- Click **Upload** on the left or drag files onto the canvas to add assets. Use **Asset library** to choose existing assets.
Expand Down
1 change: 1 addition & 0 deletions docs/guides/user-guide.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ vLLM-Omni 视频连接支持直接输入小数秒,例如 `6.583333`。CLI 可
- 点击左上角项目名称修改名称,按 `Enter` 或点击其他位置保存,按 `Esc` 取消。
- 点击名称右侧的箭头切换项目,选择“新建画布项目”创建项目。
- 在空白画布点击“配置模型”,可直接打开“设置 → 模型接入”。
- 点击“体验示例画布”可选择官方托管示例:弹窗列出当前可用的示例,选中后会下载、导入为新工程并打开。若下载到的是包裹单个 `.canvas` 的 ZIP,会自动解开;若返回的是网页而不是文件,会明确提示而不会导入。下载失败时可用该行的“无法下载?手动导入”链接,再手动把 `.canvas` 文件拖入画布。
- 通过左侧工具栏或双击空白画布创建文本、图片、视频、音频、时间线或主体节点。
- 右键空白画布可新建节点、粘贴、撤销或重做。
- 点击左侧“上传”或将文件拖入画布添加素材;“资产库”可选择已有素材。
Expand Down
54 changes: 54 additions & 0 deletions public/example-canvases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"schemaVersion": 1,
"updatedAt": "2026-11-17T06:40:00Z",
"items": [
{
"id": "image-canvas",
"title": {
"zh-CN": "图像创作示例画布",
"en-US": "Image creation example canvas"
},
"summary": {
"zh-CN": "图片生成、主体替换与参考素材的入门示例",
"en-US": "Image generation, subject replacement and references"
},
"url": "https://lz.qaiu.top/parser?url=https://wwbks.lanzouv.com/i1BWT4ga8c6h&pwd=4b6t",
"filename": "图像创作示例画布.zip",
"sha256": "12566c858dab7a4ccbefa757a0d69965b526b9c253b472034137445f1c93b0cb",
"bytes": 27582888,
"contentKind": "zip-wrapper",
"inner": {
"entry": "图像创作示例画布.canvas",
"sha256": "60f40d2aaa54b65724081efab1b58b0e41f0dd78d6793dcf95ea9ee3dd97f911",
"bytes": 27689522,
"archiveVersion": 2,
"assets": 5,
"nodes": 12
}
},
{
"id": "video-canvas",
"title": {
"zh-CN": "视频创作示例画布",
"en-US": "Video creation example canvas"
},
"summary": {
"zh-CN": "时间线、文生视频与图生视频的组合示例",
"en-US": "Timeline with text-to-video and image-to-video"
},
"url": "https://lz.qaiu.top/parser?url=https://wwbks.lanzouv.com/iUPML4ga8bch&pwd=905a",
"filename": "视频创作示例画布.zip",
"sha256": "9c1662d6eec2ee1f9765ca53473cd1a93ab0ceeb841e8c0db895cd522a0bb13e",
"bytes": 26086524,
"contentKind": "zip-wrapper",
"inner": {
"entry": "视频创作示例画布.canvas",
"sha256": "76b10a86f0900816095c2b03c7533514db7fbe4ee968fe8338da55905e1cd8e5",
"bytes": 26128975,
"archiveVersion": 2,
"assets": 9,
"nodes": 17
}
}
]
}
10 changes: 4 additions & 6 deletions scripts/i18n-baseline.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{
"total": 168,
"total": 173,
"counts": {
"src/canvas/assets.ts": 14,
"src/canvas/workspace/useWorkspaceTransfer.ts": 1,
"src/canvas/dataBoundary.ts": 3,
"src/canvas/generationCatalog.ts": 16,
"src/canvas/generationSettings.ts": 4,
"src/canvas/library/AssetsPanel.tsx": 1,
"src/canvas/library/libraryClient.ts": 1,
"src/canvas/library/SubjectsPanel.tsx": 1,
"src/canvas/library/TrashPanel.tsx": 1,
"src/canvas/model.ts": 1,
"src/canvas/NodeComposer.tsx": 1,
"src/canvas/referenceMentions.ts": 1,
"src/canvas/toolCatalog.ts": 123
"src/canvas/toolCatalog.ts": 123,
"src/canvas/workspace/example/exampleCatalog.ts": 8,
"src/canvas/workspace/useWorkspaceTransfer.ts": 1
}
}
4 changes: 4 additions & 0 deletions scripts/run-browser-suite.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import { spawnSync } from "node:child_process";

const workflows = [
{ name: "timeline node output", script: "tests/browser/timeline_node_output.mjs" },
{
name: "example canvas picker",
script: "tests/browser/example_canvas_picker.mjs",
},
{ name: "locale", script: "tests/browser/locale.mjs" },
{ name: "creation closure", script: "scripts/verify_creation_browser.mjs" },
{ name: "assistant activity", script: "tests/browser/assistant_activity.mjs" },
Expand Down
17 changes: 17 additions & 0 deletions src/canvas/ProjectSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function ProjectSelector({
disabled,
onSelect,
onCreate,
onExamples,
onRename,
onRenameProject,
onDeleteProject,
Expand All @@ -31,6 +32,8 @@ export function ProjectSelector({
disabled: boolean;
onSelect: (project: WorkspaceProject) => Promise<boolean>;
onCreate: () => void;
/** Opens the example canvas picker; omitted where it is not offered. */
onExamples?: () => void;
onRename: (name: string) => Promise<void>;
onRenameProject: (project: WorkspaceProject, name: string) => Promise<void>;
onDeleteProject: (project: WorkspaceProject) => Promise<void>;
Expand Down Expand Up @@ -462,6 +465,20 @@ export function ProjectSelector({
<CanvasIcon name="trash" size={18} />
</button>
)}
{onExamples && (
<button
className="cw-project-examples"
role="menuitem"
disabled={busy || loading || disabled}
onClick={() => {
setOpen(false);
onExamples();
}}
>
<span>{t("canvas.project.examples")}</span>
<CanvasIcon name="clapperboard" size={18} />
</button>
)}
<button
className="cw-project-create"
role="menuitem"
Expand Down
26 changes: 26 additions & 0 deletions src/canvas/workspace.css
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@
flex-shrink: 0;
}
.cw-project-create,
.cw-project-examples,
.cw-project-cleanup {
display: flex;
align-items: center;
Expand All @@ -623,6 +624,7 @@
text-align: left;
}
.cw-project-create:hover,
.cw-project-examples:hover,
.cw-project-cleanup:hover {
color: #fff;
}
Expand Down Expand Up @@ -1222,6 +1224,30 @@
padding: 10px 16px;
font-size: 12px;
}

.cw-empty-example-status {
gap: 8px;
margin: 16px auto 0;
max-width: 320px;
font-size: 12px;
color: #9599a8;
}

.cw-empty-example-status .cw-example-progress {
flex: 1;
min-width: 120px;
}

/* Specificity beats the shared .cw-empty small tagline rule. */
.cw-empty small.cw-empty-example-error {
display: block;
margin: 12px auto 0;
max-width: 420px;
color: #e08a8a;
font-size: 12px;
line-height: 1.6;
}

.cw-empty button:hover {
background: #2a2a2d;
}
Expand Down
126 changes: 112 additions & 14 deletions src/canvas/workspace/WorkspaceView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Background, BackgroundVariant, MiniMap, SelectionMode, ViewportPortal } from "@xyflow/react";

import "@xyflow/react/dist/style.css";
import { Suspense, useEffect, type CSSProperties } from "react";
import { Suspense, useEffect, useRef, useState, type CSSProperties } from "react";
import { createNode } from "../model.ts";
import { NodeVersionHistory } from "../NodeVersionHistory";

Expand All @@ -17,8 +17,18 @@ import { TimelinePackageImport, exportTimelinePackage as exportNativeTimelinePac
import { readLocalResource } from "../timelineExport.ts";
import { timelinePublication } from "../../backend/timelinePublication";
import { acknowledgeToolPlacement, cancelToolTask } from "../../backend/tools.ts";
import { createWorkspaceProject, listWorkspaceProjects, openExampleWorkspaceProject, openWorkspaceProject, saveWorkspaceDocument, workspaceProjection } from "../../backend/workspace";
import { exampleDocument, exampleProjectTitle, studyImage } from "../assets";
import { createWorkspaceProject, listWorkspaceProjects, openWorkspaceProject, saveWorkspaceDocument, workspaceProjection } from "../../backend/workspace";
import { studyImage } from "../assets";
import { ExampleCanvasDialog } from "./example/ExampleCanvasDialog.tsx";
import {
IMAGE_EXAMPLE_ID,
VIDEO_EXAMPLE_ID,
availableExamples,
loadExampleCatalog,
type ExampleEntry,
} from "./example/exampleCatalog.ts";
import { exampleFailureText, examplePercent } from "./example/exampleFailure.ts";
import { useExampleImport } from "./example/useExampleImport.ts";

import { AssistantPanel } from "../AssistantPanel";
import { CanvasActionsContext } from "../CanvasActionsContext";
Expand Down Expand Up @@ -167,6 +177,7 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) {
historyReplaying,
importActionResultFiles,
importActionResults,
importCanvasArchive,
importCanvasSource,
importDocument,
importFiles,
Expand Down Expand Up @@ -301,6 +312,51 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) {
} = rt;


/**
* Example canvases: one cached catalog feeds both the empty-state buttons and
* the picker in the project menu.
*/
const [exampleEntries, setExampleEntries] = useState<ExampleEntry[] | null>(null);
const [exampleLoading, setExampleLoading] = useState(false);
const exampleCatalog = useRef<Promise<ExampleEntry[]> | null>(null);
const loadExamples = () =>
(exampleCatalog.current ??= loadExampleCatalog().then((result) =>
availableExamples(result.catalog),
));
const openExamplePicker = async () => {
if (exampleLoading) return;
setExampleLoading(true);
try {
setExampleEntries(await loadExamples());
} finally {
setExampleLoading(false);
}
};
const exampleImport = useExampleImport({ importCanvas: importCanvasArchive });
const [exampleMissing, setExampleMissing] = useState(false);
const runExampleButton = async (id: string) => {
setExampleMissing(false);
exampleImport.reset(IMAGE_EXAMPLE_ID);
exampleImport.reset(VIDEO_EXAMPLE_ID);
const entry = (await loadExamples()).find((item) => item.id === id);
if (!entry) {
setExampleMissing(true);
return;
}
// A finished import switches the document, so the bar disappears with it.
if (await exampleImport.start(entry)) exampleImport.reset(entry.id);
};
const exampleButtonStatus =
exampleImport.statuses[IMAGE_EXAMPLE_ID] ??
exampleImport.statuses[VIDEO_EXAMPLE_ID];
const exampleBusy =
exampleButtonStatus?.phase === "downloading" ||
exampleButtonStatus?.phase === "importing";
const exampleProgress = exampleButtonStatus
? examplePercent(exampleButtonStatus)
: null;


const outputState = timelineOutput.state;
const outputSource = outputState ? doc.nodes.find((node) => node.id === outputState.itemId) : undefined;
const existingOutput = outputState ? projected.nodes.find((node: { id: string }) => node.id === outputState.output.id) : undefined;
Expand Down Expand Up @@ -845,6 +901,7 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) {
return document;
}).then(success => { if (success) setEditProjectNameId(id); });
}}
onExamples={() => void openExamplePicker()}
onRename={renameCurrentProject}
onRenameProject={renameProject}
onDeleteProject={deleteProject}
Expand Down Expand Up @@ -1009,20 +1066,54 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) {
{t("canvas.workspace.empty.configureModels")}
</button>
<button
onClick={() => {
void switchDocument(
() =>
openExampleWorkspaceProject(
exampleProjectTitle(locale),
() => exampleDocument(locale),
),
true,
);
}}
disabled={exampleBusy}
onClick={() => void runExampleButton(IMAGE_EXAMPLE_ID)}
>
<CanvasIcon name="image" size={15} />
{t("canvas.workspace.empty.tryImage")}
</button>
<button
disabled={exampleBusy}
onClick={() => void runExampleButton(VIDEO_EXAMPLE_ID)}
>
{t("canvas.workspace.empty.example")} <span>↗</span>
<CanvasIcon name="video" size={15} />
{t("canvas.workspace.empty.tryVideo")}
</button>
</div>
{exampleBusy && exampleButtonStatus && (
<div
className="cw-empty-example-status"
role="status"
aria-live="polite"
>
<progress
className="cw-example-progress"
aria-label={t("canvas.example.progress.label")}
{...(exampleProgress === null
? {}
: {
value: exampleButtonStatus.received ?? 0,
max: exampleButtonStatus.total ?? 1,
})}
/>
<span>
{exampleButtonStatus.phase === "importing"
? t("canvas.example.state.importing")
: exampleProgress === null
? t("canvas.example.state.downloading")
: t("canvas.example.state.downloadingPercent", {
percent: exampleProgress,
})}
</span>
</div>
)}
{(exampleMissing || exampleButtonStatus?.phase === "failed") && (
<small className="cw-empty-example-error" role="alert">
{exampleMissing
? t("canvas.example.error.unknown")
: exampleFailureText(t, exampleButtonStatus!)}
</small>
)}
<small>{t("canvas.workspace.empty.tagline")}</small>
</div>
)}
Expand Down Expand Up @@ -2728,6 +2819,13 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) {
onClose={() => { dismissModelSetup(); setSettingsOpen(false); }}
/>
)}
{exampleEntries && (
<ExampleCanvasDialog
entries={exampleEntries}
onClose={() => setExampleEntries(null)}
onImport={(archive) => importCanvasArchive(archive)}
/>
)}
{help && (
<div className="cw-modal-backdrop" onClick={() => setHelp(false)}>
<section
Expand Down
Loading
Loading