feat(create): 创作首页与灵感库 - 纵深画廊、灵感页面、外部提示词池 (#708)
* feat(create): 创作首页与灵感库 - 纵深画廊、灵感页面、外部提示词池 创作首页空态换成直线纵深图片画廊:11 张横版卡片沿 Z 轴前后排队,当前一张 在最前最大,滚轮、左右按钮或自动轮播切换,卡片带玻璃描边和"行动点 / 标题 / 描述"三段信息,跟随输入框的创作类型联动换队。队列是随机取样并记住最近出现过的 条目,走完一轮自动换批,不再反复看到同样那几张。 左侧「创作」下方新增灵感页:1341 条提示词按来源、分类和创作类型筛选, 支持搜索、收藏,以及自建灵感的新建、编辑、删除和 JSON 导入导出。 新增 scripts/import-inspirations.mjs,从 awesome-seedance、好好学 AI 和 YouMind 两个姊妹库同步条目,并为画廊池生成本地 webp 缩略图(560px / q72, 约 35KB 一张)。上游封面平均 400KB~700KB,直接引用一屏 11 张要拉 5MB 以上, 换成本地缩略图后约 400KB。 画廊池改走 public/inspirations/gallery-pool.json 运行时拉取:几百条提示词正文 压在首屏 JS 上是白背的,而这份数据只服务画廊一处。缩略图等距抽取,横跨各来源 的全部分类;只收描述非空的条目,保证卡片三行版式不缺角。 * docs(create): 功能清单与地图 - 补充纵深画廊与灵感库 功能清单新增「创作首页纵深画廊与灵感库」一节,并在功能地图里记下画廊、 灵感页、运行时目录加载和导入脚本各自的代码入口;待测试清单记下浏览器验收结果 与仍未确认的边界(弱网退回、窄屏、文本条目偏少、外部来源署名)。
This commit is contained in:
1 parent
295374650a
commit
04689257d2
384 files changed
+3018
-84
No files matched your search
@@ -0,0 +1,451 @@
|
||||
import { App, Button, Dropdown, Input } from "antd";
|
||||
import { Download, Heart, Import, MoreHorizontal, Pencil, Plus, RotateCcw, Search, Trash2 } from "lucide-react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useNavigate } from "react-router";
|
||||
|
||||
import { PageHeader, PaginationBar, WorkspacePage } from "@/components/layout/workspace-page";
|
||||
import { WorkspaceErrorState, WorkspaceLoadingState, WorkspaceState } from "@/components/layout/workspace-state";
|
||||
import { SegmentedControl } from "@/components/ui/base/segmented-control";
|
||||
import { Select } from "@/components/ui/base/select";
|
||||
import { Tooltip } from "@/components/ui/base/tooltip";
|
||||
import { useDebouncedValue } from "@/hooks/use-debounced-value";
|
||||
import { catalogIdOf, inspirationSourceOf, inspirationSources, type CreationInspiration, type InspirationSourceId } from "@/lib/inspirations/catalog";
|
||||
import { fillablePrompt, isCustomInspiration, resolveInspirations } from "@/lib/inspirations/resolve";
|
||||
import { loadInspirationCatalog, type InspirationCatalog } from "@/services/inspiration-catalog";
|
||||
import { useInspirationStore } from "@/stores/use-inspiration-store";
|
||||
import { InspirationDetailModal } from "./inspiration-detail-modal";
|
||||
import { InspirationEditorModal, type InspirationCategoryChoice } from "./inspiration-editor-modal";
|
||||
import "./inspirations.css";
|
||||
|
||||
type SourceFilter = "all" | InspirationSourceId;
|
||||
type ViewFilter = "all" | "favorites" | "hidden";
|
||||
type ModeFilter = "all" | CreationInspiration["mode"];
|
||||
type SortKey = "default" | "title";
|
||||
/** 分类标签比编辑器里的选项多一个条目数,用于在标签上显示数量。 */
|
||||
type CategoryChoice = InspirationCategoryChoice & { count: number };
|
||||
|
||||
/** 来源筛选的顺序。必须覆盖 inspirationSources 里全部有内容的来源,漏掉就会有条目筛不到。 */
|
||||
const SOURCE_ORDER: InspirationSourceId[] = ["original", "chatgpt-prompts", "seedance", "haohaoxue", "youmind"];
|
||||
const VIEW_OPTIONS: { label: string; value: ViewFilter }[] = [
|
||||
{ label: "全部", value: "all" },
|
||||
{ label: "收藏", value: "favorites" },
|
||||
{ label: "已隐藏", value: "hidden" },
|
||||
];
|
||||
const SORT_OPTIONS = [
|
||||
{ label: "默认顺序", value: "default" },
|
||||
{ label: "按标题", value: "title" },
|
||||
];
|
||||
|
||||
/** 导出文件名带上日期,重复导出不会互相覆盖。 */
|
||||
function exportFileName() {
|
||||
return `yingce-inspirations-${new Date().toISOString().slice(0, 10)}.json`;
|
||||
}
|
||||
|
||||
function downloadText(text: string, fileName: string) {
|
||||
const url = URL.createObjectURL(new Blob([text], { type: "application/json" }));
|
||||
const anchor = document.createElement("a");
|
||||
anchor.href = url;
|
||||
anchor.download = fileName;
|
||||
anchor.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
export default function InspirationsPage() {
|
||||
const { message, modal } = App.useApp();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const custom = useInspirationStore((state) => state.custom);
|
||||
const overrides = useInspirationStore((state) => state.overrides);
|
||||
const hidden = useInspirationStore((state) => state.hidden);
|
||||
const favorites = useInspirationStore((state) => state.favorites);
|
||||
const hydrated = useInspirationStore((state) => state.hydrated);
|
||||
const createEntry = useInspirationStore((state) => state.createEntry);
|
||||
const updateEntry = useInspirationStore((state) => state.updateEntry);
|
||||
const removeEntry = useInspirationStore((state) => state.removeEntry);
|
||||
const restoreEntry = useInspirationStore((state) => state.restoreEntry);
|
||||
const toggleFavorite = useInspirationStore((state) => state.toggleFavorite);
|
||||
const exportPayload = useInspirationStore((state) => state.exportPayload);
|
||||
const importPayload = useInspirationStore((state) => state.importPayload);
|
||||
|
||||
const [catalog, setCatalog] = useState<InspirationCatalog | null>(null);
|
||||
const [loadError, setLoadError] = useState("");
|
||||
const [reloadKey, setReloadKey] = useState(0);
|
||||
|
||||
const [source, setSource] = useState<SourceFilter>("all");
|
||||
const [modeFilter, setModeFilter] = useState<ModeFilter>("all");
|
||||
const [category, setCategory] = useState("all");
|
||||
const [view, setView] = useState<ViewFilter>("all");
|
||||
const [sort, setSort] = useState<SortKey>("default");
|
||||
const [search, setSearch] = useState("");
|
||||
const debouncedSearch = useDebouncedValue(search, 250);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(24);
|
||||
|
||||
const [detail, setDetail] = useState<CreationInspiration | null>(null);
|
||||
const [editorOpen, setEditorOpen] = useState(false);
|
||||
const [editing, setEditing] = useState<CreationInspiration | null>(null);
|
||||
const importRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
setLoadError("");
|
||||
loadInspirationCatalog()
|
||||
.then((loaded) => { if (!cancelled) setCatalog(loaded); })
|
||||
.catch((error) => { if (!cancelled) setLoadError(error instanceof Error ? error.message : "灵感目录加载失败"); });
|
||||
return () => { cancelled = true; };
|
||||
}, [reloadKey]);
|
||||
|
||||
// 筛选条件一变就回第一页,否则会停在一个已经不存在的位置上。
|
||||
useEffect(() => { setPage(1); }, [source, modeFilter, category, view, sort, debouncedSearch, pageSize]);
|
||||
|
||||
const overlay = useMemo(() => ({ custom, overrides, hidden }), [custom, hidden, overrides]);
|
||||
const resolved = useMemo(() => (catalog ? resolveInspirations(catalog.entries, overlay) : []), [catalog, overlay]);
|
||||
|
||||
/** 隐藏态在合成结果里已经滤掉了,单独还原一份给「已隐藏」视图。 */
|
||||
const hiddenItems = useMemo(() => {
|
||||
if (!catalog) return [];
|
||||
const hiddenSet = new Set(hidden);
|
||||
return catalog.entries.filter((item) => hiddenSet.has(catalogIdOf(item)));
|
||||
}, [catalog, hidden]);
|
||||
|
||||
const categoryLabels = useMemo(() => {
|
||||
const map = new Map<string, Map<string, string>>();
|
||||
for (const [sourceId, options] of Object.entries(catalog?.categoriesBySource ?? {})) {
|
||||
map.set(sourceId, new Map(options.map((option) => [option.id, option.label])));
|
||||
}
|
||||
return map;
|
||||
}, [catalog]);
|
||||
|
||||
const categoryLabel = useCallback(
|
||||
(item: CreationInspiration) => {
|
||||
const code = item.category?.trim();
|
||||
if (!code) return "未分类";
|
||||
return categoryLabels.get(item.sourceId ?? "original")?.get(code) ?? code;
|
||||
},
|
||||
[categoryLabels],
|
||||
);
|
||||
|
||||
/** 分类标签跟随来源:选了某个来源就不该再出现别的来源的分类。 */
|
||||
const categoryChoices = useMemo<CategoryChoice[]>(() => {
|
||||
if (!catalog) return [];
|
||||
const sources = source === "all" ? SOURCE_ORDER : [source];
|
||||
const merged = new Map<string, { label: string; count: number }>();
|
||||
for (const sourceId of sources) {
|
||||
for (const option of catalog.categoriesBySource[sourceId] ?? []) {
|
||||
const current = merged.get(option.id);
|
||||
merged.set(option.id, { label: option.label, count: (current?.count ?? 0) + option.count });
|
||||
}
|
||||
}
|
||||
return [...merged.entries()]
|
||||
.sort((left, right) => right[1].count - left[1].count || left[1].label.localeCompare(right[1].label, "zh-Hans-CN"))
|
||||
.map(([value, { label, count }]) => ({ value, label, count }));
|
||||
}, [catalog, source]);
|
||||
|
||||
const sourceCounts = useMemo(() => {
|
||||
const counts = new Map<SourceFilter, number>();
|
||||
counts.set("all", resolved.length + hiddenItems.length);
|
||||
for (const item of [...resolved, ...hiddenItems]) {
|
||||
const key = item.sourceId ?? "original";
|
||||
counts.set(key, (counts.get(key) ?? 0) + 1);
|
||||
}
|
||||
return counts;
|
||||
}, [resolved, hiddenItems]);
|
||||
|
||||
/** 图片 / 视频 / 文本是库里的两大主类(文本较少),按当前视图与来源统计数量。 */
|
||||
const modeCounts = useMemo(() => {
|
||||
const counts: Record<ModeFilter, number> = { all: 0, image: 0, video: 0, text: 0 };
|
||||
const pool = view === "hidden" ? hiddenItems : resolved;
|
||||
const favoriteSet = new Set(favorites);
|
||||
for (const item of pool) {
|
||||
if (view === "favorites" && !favoriteSet.has(catalogIdOf(item))) continue;
|
||||
if (source !== "all" && (item.sourceId ?? "original") !== source) continue;
|
||||
counts.all += 1;
|
||||
counts[item.mode] += 1;
|
||||
}
|
||||
return counts;
|
||||
}, [view, resolved, hiddenItems, favorites, source]);
|
||||
|
||||
const modeOptions = useMemo(
|
||||
() => [
|
||||
{ label: `全部 ${modeCounts.all}`, value: "all" as ModeFilter },
|
||||
{ label: `图片 ${modeCounts.image}`, value: "image" as ModeFilter },
|
||||
{ label: `视频 ${modeCounts.video}`, value: "video" as ModeFilter },
|
||||
{ label: `文本 ${modeCounts.text}`, value: "text" as ModeFilter },
|
||||
],
|
||||
[modeCounts],
|
||||
);
|
||||
|
||||
const visible = useMemo(() => {
|
||||
const pool = view === "hidden" ? hiddenItems : resolved;
|
||||
const keyword = debouncedSearch.trim().toLowerCase();
|
||||
const favoriteSet = new Set(favorites);
|
||||
const filtered = pool.filter((item) => {
|
||||
if (view === "favorites" && !favoriteSet.has(catalogIdOf(item))) return false;
|
||||
if (source !== "all" && (item.sourceId ?? "original") !== source) return false;
|
||||
if (modeFilter !== "all" && item.mode !== modeFilter) return false;
|
||||
if (category !== "all" && (item.category?.trim() ?? "") !== category) return false;
|
||||
if (!keyword) return true;
|
||||
const haystack = [item.title, item.description, item.category, categoryLabel(item), ...(item.tags ?? [])].join(" ").toLowerCase();
|
||||
return haystack.includes(keyword);
|
||||
});
|
||||
if (sort === "title") return [...filtered].sort((left, right) => left.title.localeCompare(right.title, "zh-Hans-CN"));
|
||||
return filtered;
|
||||
}, [view, resolved, hiddenItems, debouncedSearch, favorites, source, modeFilter, category, sort, categoryLabel]);
|
||||
|
||||
const paged = useMemo(() => visible.slice((page - 1) * pageSize, page * pageSize), [visible, page, pageSize]);
|
||||
|
||||
const handleUse = useCallback((item: CreationInspiration) => {
|
||||
navigate("/create", { state: { inspirationPrompt: fillablePrompt(item), inspirationMode: item.mode } });
|
||||
}, [navigate]);
|
||||
|
||||
const handleCopy = useCallback((text: string, label: string) => {
|
||||
void navigator.clipboard.writeText(text).then(
|
||||
() => message.success(`${label}已复制`),
|
||||
() => message.error("复制失败,请手动选中文本"),
|
||||
);
|
||||
}, [message]);
|
||||
|
||||
const handleDelete = useCallback((item: CreationInspiration) => {
|
||||
const id = catalogIdOf(item);
|
||||
const isCustom = isCustomInspiration(id);
|
||||
modal.confirm({
|
||||
className: "workspace-modal workspace-modal-compact",
|
||||
title: isCustom ? "删除这条灵感?" : "从库中隐藏这条灵感?",
|
||||
content: isCustom
|
||||
? `「${item.title}」会从本地灵感库移除,此操作不可撤销。`
|
||||
: `「${item.title}」来自外部目录,不能真正删除;隐藏后可用「已隐藏」视图恢复,重新导入外部目录也不会让它复现。`,
|
||||
okText: isCustom ? "删除" : "隐藏",
|
||||
okButtonProps: { danger: true },
|
||||
cancelText: "保留",
|
||||
onOk: () => {
|
||||
removeEntry(id);
|
||||
if (detail && catalogIdOf(detail) === id) setDetail(null);
|
||||
message.success(isCustom ? "已删除" : "已隐藏");
|
||||
},
|
||||
});
|
||||
}, [detail, message, modal, removeEntry]);
|
||||
|
||||
const handleSubmit = useCallback((draft: Parameters<typeof createEntry>[0]) => {
|
||||
if (editing) {
|
||||
updateEntry(catalogIdOf(editing), draft);
|
||||
message.success("已保存修改");
|
||||
setDetail((current) => (current && catalogIdOf(current) === catalogIdOf(editing) ? { ...current, ...draft } : current));
|
||||
setEditing(null);
|
||||
return;
|
||||
}
|
||||
createEntry(draft);
|
||||
// 新建后把筛选整体清掉:自建条目的来源固定是「原创」、分类也常和当前筛选不符,
|
||||
// 不清的话用户刚点完"创建"却看不到自己建的东西。
|
||||
setSource("all");
|
||||
setModeFilter("all");
|
||||
setCategory("all");
|
||||
setView("all");
|
||||
setSearch("");
|
||||
message.success("灵感已创建");
|
||||
}, [createEntry, editing, message, updateEntry]);
|
||||
|
||||
const handleExport = useCallback(() => {
|
||||
downloadText(exportPayload(), exportFileName());
|
||||
message.success("已导出本地改动(自建条目 / 改写 / 隐藏 / 收藏)");
|
||||
}, [exportPayload, message]);
|
||||
|
||||
const handleImportFile = useCallback(async (file: File) => {
|
||||
try {
|
||||
const result = importPayload(await file.text());
|
||||
message.success(`导入完成:新增 ${result.created},覆盖 ${result.updated}${result.skipped ? `,跳过 ${result.skipped} 条无效数据` : ""}`);
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : "导入失败");
|
||||
}
|
||||
}, [importPayload, message]);
|
||||
|
||||
const headerActions = (
|
||||
<>
|
||||
<Button icon={<Import className="size-4" />} onClick={() => importRef.current?.click()}>导入</Button>
|
||||
<Button icon={<Download className="size-4" />} onClick={handleExport}>导出</Button>
|
||||
<Button type="primary" icon={<Plus className="size-4" />} onClick={() => { setEditing(null); setEditorOpen(true); }}>新建灵感</Button>
|
||||
<input
|
||||
ref={importRef}
|
||||
type="file"
|
||||
accept="application/json,.json"
|
||||
className="hidden"
|
||||
onChange={(event) => {
|
||||
const file = event.target.files?.[0];
|
||||
// 同一个文件连续导入两次也要触发,所以每次都清空 value。
|
||||
event.target.value = "";
|
||||
if (file) void handleImportFile(file);
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
const total = catalog ? resolved.length + hiddenItems.length : 0;
|
||||
|
||||
return (
|
||||
<WorkspacePage>
|
||||
<PageHeader
|
||||
title="灵感库"
|
||||
description={`${total} 条提示词,按来源、分类和创作类型挑,点开可以一键带去创作页`}
|
||||
actions={headerActions}
|
||||
/>
|
||||
|
||||
{loadError ? (
|
||||
<WorkspaceErrorState title="灵感目录加载失败" description={loadError} onRetry={() => setReloadKey((key) => key + 1)} />
|
||||
) : !catalog || !hydrated ? (
|
||||
<WorkspaceLoadingState label="正在加载灵感目录" detail="首次进入需要拉取全量目录,之后会走浏览器缓存" rows={4} />
|
||||
) : (
|
||||
<div className="mt-4 flex flex-col gap-4">
|
||||
{/* 图片 / 视频 / 文本是两大主类,放在最上面做一级筛选。 */}
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<SegmentedControl options={modeOptions} value={modeFilter} onChange={(value) => setModeFilter(value as ModeFilter)} ariaLabel="按创作类型筛选" />
|
||||
<span className="text-xs text-foreground/50">共 {visible.length} 条</span>
|
||||
</div>
|
||||
|
||||
{/* 分类标签是二级筛选:一眼看到库里都有什么,点一下就能缩小范围。 */}
|
||||
<div className="flex flex-wrap items-center gap-2" role="group" aria-label="按分类筛选">
|
||||
<button type="button" className="inspiration-chip" aria-pressed={category === "all"} onClick={() => setCategory("all")}>
|
||||
全部分类
|
||||
<span className="inspiration-chip-count">{source === "all" ? resolved.length : (sourceCounts.get(source) ?? 0)}</span>
|
||||
</button>
|
||||
{categoryChoices.slice(0, 16).map((choice) => (
|
||||
<button
|
||||
key={choice.value}
|
||||
type="button"
|
||||
className="inspiration-chip"
|
||||
aria-pressed={category === choice.value}
|
||||
onClick={() => setCategory(category === choice.value ? "all" : choice.value)}
|
||||
>
|
||||
{choice.label}
|
||||
<span className="inspiration-chip-count">{choice.count}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Input
|
||||
allowClear
|
||||
prefix={<Search className="size-4 text-foreground/40" />}
|
||||
placeholder="搜标题、描述或标签"
|
||||
value={search}
|
||||
onChange={(event) => setSearch(event.target.value)}
|
||||
className="max-w-xs"
|
||||
/>
|
||||
<SegmentedControl options={VIEW_OPTIONS} value={view} onChange={(value) => setView(value as ViewFilter)} />
|
||||
<Select
|
||||
options={[
|
||||
{ label: `全部来源 (${resolved.length})`, value: "all" },
|
||||
...SOURCE_ORDER.filter((key) => (sourceCounts.get(key) ?? 0) > 0).map((key) => ({
|
||||
label: `${inspirationSources[key].name ?? inspirationSources[key].label} (${sourceCounts.get(key) ?? 0})`,
|
||||
value: key,
|
||||
})),
|
||||
]}
|
||||
value={source}
|
||||
onChange={(value) => { setSource(value as SourceFilter); setCategory("all"); }}
|
||||
className="w-52"
|
||||
/>
|
||||
<Select options={SORT_OPTIONS} value={sort} onChange={(value) => setSort(value as SortKey)} className="w-32" />
|
||||
<span className="text-xs text-foreground/50">共 {visible.length} 条</span>
|
||||
</div>
|
||||
|
||||
{paged.length ? (
|
||||
<div className="inspiration-gallery">
|
||||
{paged.map((item) => {
|
||||
const id = catalogIdOf(item);
|
||||
const favorite = favorites.includes(id);
|
||||
return (
|
||||
<article
|
||||
key={id}
|
||||
className="inspiration-card"
|
||||
tabIndex={0}
|
||||
role="button"
|
||||
onClick={() => setDetail(item)}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
setDetail(item);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="inspiration-card-cover">
|
||||
<img src={item.image} alt="" loading="lazy" decoding="async" referrerPolicy="no-referrer" />
|
||||
<span className="inspiration-card-source">{inspirationSourceOf(item).label}</span>
|
||||
<div className="inspiration-card-actions">
|
||||
<Tooltip title={favorite ? "取消收藏" : "收藏"}>
|
||||
<button type="button" className="inspiration-card-action" aria-pressed={favorite} onClick={(event) => { event.stopPropagation(); toggleFavorite(id); }}>
|
||||
<Heart className="size-3.5" fill={favorite ? "currentColor" : "none"} />
|
||||
</button>
|
||||
</Tooltip>
|
||||
{view === "hidden" ? (
|
||||
<Tooltip title="恢复显示">
|
||||
<button type="button" className="inspiration-card-action" onClick={(event) => { event.stopPropagation(); restoreEntry(id); }}>
|
||||
<RotateCcw className="size-3.5" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<Dropdown
|
||||
trigger={["click"]}
|
||||
menu={{
|
||||
items: [
|
||||
{ key: "edit", icon: <Pencil className="size-3.5" />, label: "编辑" },
|
||||
{ key: "delete", icon: <Trash2 className="size-3.5" />, label: isCustomInspiration(id) ? "删除" : "隐藏", danger: true },
|
||||
],
|
||||
onClick: ({ key, domEvent }) => {
|
||||
domEvent.stopPropagation();
|
||||
if (key === "edit") { setEditing(item); setEditorOpen(true); }
|
||||
if (key === "delete") handleDelete(item);
|
||||
},
|
||||
}}
|
||||
>
|
||||
<button type="button" className="inspiration-card-action" aria-label="更多操作" onClick={(event) => event.stopPropagation()}>
|
||||
<MoreHorizontal className="size-3.5" />
|
||||
</button>
|
||||
</Dropdown>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="inspiration-card-body">
|
||||
<h3 className="inspiration-card-title">{item.title}</h3>
|
||||
<p className="inspiration-card-desc">{item.description}</p>
|
||||
<div className="inspiration-card-tags">
|
||||
<span className="inspiration-chip">{categoryLabel(item)}</span>
|
||||
{item.ratio ? <span className="inspiration-chip">{item.ratio}</span> : null}
|
||||
{item.credit ? <span className="inspiration-chip">{item.credit}</span> : null}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<WorkspaceState
|
||||
icon="empty"
|
||||
title={view === "favorites" ? "还没有收藏" : view === "hidden" ? "没有隐藏的条目" : "没有符合条件的灵感"}
|
||||
description={view === "favorites" ? "在卡片右上角点一下爱心,收藏的灵感会集中在这里。" : "换个来源、分类或关键词再试试。"}
|
||||
/>
|
||||
)}
|
||||
|
||||
<PaginationBar current={page} pageSize={pageSize} total={visible.length} onChange={(next, size) => { setPage(next); setPageSize(size); }} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<InspirationDetailModal
|
||||
item={detail}
|
||||
favorite={detail ? favorites.includes(catalogIdOf(detail)) : false}
|
||||
categoryLabel={categoryLabel}
|
||||
onClose={() => setDetail(null)}
|
||||
onUse={handleUse}
|
||||
onCopy={handleCopy}
|
||||
onToggleFavorite={(item) => toggleFavorite(catalogIdOf(item))}
|
||||
onEdit={(item) => { setDetail(null); setEditing(item); setEditorOpen(true); }}
|
||||
onDelete={handleDelete}
|
||||
/>
|
||||
|
||||
<InspirationEditorModal
|
||||
open={editorOpen}
|
||||
item={editing}
|
||||
categoryOptions={categoryChoices}
|
||||
onClose={() => { setEditorOpen(false); setEditing(null); }}
|
||||
onSubmit={handleSubmit}
|
||||
/>
|
||||
</WorkspacePage>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
import { Button } from "antd";
|
||||
import { Copy, ExternalLink, Heart, Pencil, Trash2, Wand2 } from "lucide-react";
|
||||
|
||||
import { Tooltip } from "@/components/ui/base/tooltip";
|
||||
import { AppModal } from "@/components/ui/product/app-modal";
|
||||
import { catalogIdOf, inspirationSourceOf, type CreationInspiration } from "@/lib/inspirations/catalog";
|
||||
import { isCustomInspiration } from "@/lib/inspirations/resolve";
|
||||
import { modeLabels } from "@/pages/create/creation-types";
|
||||
|
||||
function MetaRow({ label, children }: { label: string; children: React.ReactNode }) {
|
||||
return (
|
||||
<div className="flex min-w-0 items-baseline gap-3 text-xs leading-5">
|
||||
<span className="w-12 shrink-0 text-foreground/45">{label}</span>
|
||||
<span className="min-w-0 flex-1 text-foreground/78">{children}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function InspirationDetailModal({
|
||||
item,
|
||||
categoryLabel,
|
||||
favorite,
|
||||
onClose,
|
||||
onUse,
|
||||
onEdit,
|
||||
onDelete,
|
||||
onToggleFavorite,
|
||||
onCopy,
|
||||
}: {
|
||||
item: CreationInspiration | null;
|
||||
categoryLabel: (item: CreationInspiration) => string;
|
||||
favorite: boolean;
|
||||
onClose: () => void;
|
||||
onUse: (item: CreationInspiration) => void;
|
||||
onEdit: (item: CreationInspiration) => void;
|
||||
onDelete: (item: CreationInspiration) => void;
|
||||
onToggleFavorite: (item: CreationInspiration) => void;
|
||||
onCopy: (text: string, label: string) => void;
|
||||
}) {
|
||||
const source = item ? inspirationSourceOf(item) : null;
|
||||
const custom = item ? isCustomInspiration(catalogIdOf(item)) : false;
|
||||
|
||||
return (
|
||||
<AppModal
|
||||
open={Boolean(item)}
|
||||
onCancel={onClose}
|
||||
width={880}
|
||||
title={null}
|
||||
footer={null}
|
||||
styles={{ body: { padding: 0 } }}
|
||||
>
|
||||
{item ? (
|
||||
<div className="flex max-h-[76vh] flex-col">
|
||||
<div className="relative shrink-0 overflow-hidden" style={{ borderRadius: "var(--r-xl, 14px)" }}>
|
||||
<img src={item.image} alt="" className="h-56 w-full object-cover sm:h-64" referrerPolicy="no-referrer" />
|
||||
</div>
|
||||
|
||||
<div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-5">
|
||||
<div className="flex flex-wrap items-start justify-between gap-3">
|
||||
<div className="min-w-0">
|
||||
<h2 className="text-[var(--fs-heading,16px)] font-semibold leading-6 text-foreground">{item.title}</h2>
|
||||
{item.description ? <p className="mt-1 text-xs leading-5 text-foreground/58">{item.description}</p> : null}
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-1.5">
|
||||
<Tooltip title={favorite ? "取消收藏" : "收藏"}>
|
||||
<button type="button" className="inspiration-icon-button" aria-pressed={favorite} onClick={() => onToggleFavorite(item)}>
|
||||
<Heart className="size-4" fill={favorite ? "currentColor" : "none"} />
|
||||
</button>
|
||||
</Tooltip>
|
||||
<Tooltip title="编辑">
|
||||
<button type="button" className="inspiration-icon-button" onClick={() => onEdit(item)}><Pencil className="size-4" /></button>
|
||||
</Tooltip>
|
||||
<Tooltip title={custom ? "删除" : "从库中隐藏"}>
|
||||
<button type="button" className="inspiration-icon-button" onClick={() => onDelete(item)}><Trash2 className="size-4" /></button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<MetaRow label="来源">{source?.name ?? "原创"}{item.credit ? ` · ${item.credit}` : ""}</MetaRow>
|
||||
<MetaRow label="分类">{categoryLabel(item)}</MetaRow>
|
||||
<MetaRow label="类型">{modeLabels[item.mode]}{item.ratio ? ` · ${item.ratio}` : ""}</MetaRow>
|
||||
{item.tags?.length ? (
|
||||
<MetaRow label="标签">
|
||||
<span className="flex flex-wrap gap-1.5">
|
||||
{item.tags.map((tag) => <span key={tag} className="inspiration-chip">{tag}</span>)}
|
||||
</span>
|
||||
</MetaRow>
|
||||
) : null}
|
||||
{item.sourceUrl ? (
|
||||
<MetaRow label="原页">
|
||||
<a className="inline-flex items-center gap-1 text-primary hover:underline" href={item.sourceUrl} target="_blank" rel="noreferrer">
|
||||
查看上游内容 <ExternalLink className="size-3" />
|
||||
</a>
|
||||
</MetaRow>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<PromptSection label={item.promptZh ? "提示词 · 中文" : "提示词"} text={item.promptZh || item.prompt} onCopy={onCopy} />
|
||||
{item.promptZh && item.prompt !== item.promptZh ? <PromptSection label="提示词 · 原文" text={item.prompt} onCopy={onCopy} /> : null}
|
||||
</div>
|
||||
|
||||
<div className="flex shrink-0 items-center justify-end gap-2 border-t border-foreground/8 px-5 py-3">
|
||||
<Button onClick={onClose}>关闭</Button>
|
||||
<Button type="primary" icon={<Wand2 className="size-4" />} onClick={() => onUse(item)}>用这个创意创作</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</AppModal>
|
||||
);
|
||||
}
|
||||
|
||||
function PromptSection({ label, text, onCopy }: { label: string; text: string; onCopy: (text: string, label: string) => void }) {
|
||||
return (
|
||||
<section className="flex flex-col gap-2">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<h3 className="text-xs font-medium text-foreground/58">{label}</h3>
|
||||
<Button size="small" icon={<Copy className="size-3.5" />} onClick={() => onCopy(text, label)}>复制</Button>
|
||||
</div>
|
||||
<div className="inspiration-prompt-block">{text}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
import { Button, Form, Input, Select } from "antd";
|
||||
|
||||
import { AppModal } from "@/components/ui/product/app-modal";
|
||||
import type { CreationInspiration } from "@/lib/inspirations/catalog";
|
||||
import { normalizeDraft, type InspirationDraft } from "@/stores/use-inspiration-store";
|
||||
|
||||
export type InspirationCategoryChoice = { label: string; value: string };
|
||||
|
||||
/** 编辑器只收集用户能填的字段;id、来源、署名由本地库自己管。 */
|
||||
type FormValues = {
|
||||
title: string;
|
||||
description?: string;
|
||||
image: string;
|
||||
mode: CreationInspiration["mode"];
|
||||
category?: string;
|
||||
tags?: string;
|
||||
ratio?: string;
|
||||
prompt: string;
|
||||
promptZh?: string;
|
||||
};
|
||||
|
||||
function toFormValues(item: CreationInspiration | null): FormValues {
|
||||
return {
|
||||
title: item?.title ?? "",
|
||||
description: item?.description ?? "",
|
||||
image: item?.image ?? "",
|
||||
mode: item?.mode ?? "image",
|
||||
category: item?.category ?? "",
|
||||
tags: item?.tags?.join(",") ?? "",
|
||||
ratio: item?.ratio ?? "",
|
||||
prompt: item?.prompt ?? "",
|
||||
promptZh: item?.promptZh ?? "",
|
||||
};
|
||||
}
|
||||
|
||||
export function InspirationEditorModal({
|
||||
open,
|
||||
item,
|
||||
categoryOptions,
|
||||
onClose,
|
||||
onSubmit,
|
||||
}: {
|
||||
open: boolean;
|
||||
item: CreationInspiration | null;
|
||||
categoryOptions: InspirationCategoryChoice[];
|
||||
onClose: () => void;
|
||||
onSubmit: (draft: InspirationDraft) => void;
|
||||
}) {
|
||||
const [form] = Form.useForm<FormValues>();
|
||||
|
||||
const handleOk = async () => {
|
||||
const values = await form.validateFields().catch(() => null);
|
||||
if (!values) return;
|
||||
const tags = (values.tags ?? "")
|
||||
.split(/[,,]/)
|
||||
.map((tag) => tag.trim())
|
||||
.filter(Boolean);
|
||||
// 走 store 里同一套收敛规则,表单不做第二套校验。
|
||||
const draft = normalizeDraft({
|
||||
title: values.title,
|
||||
description: values.description ?? "",
|
||||
image: values.image,
|
||||
mode: values.mode,
|
||||
prompt: values.prompt,
|
||||
promptZh: values.promptZh,
|
||||
category: values.category,
|
||||
ratio: values.ratio,
|
||||
...(tags.length ? { tags } : {}),
|
||||
});
|
||||
onSubmit(draft);
|
||||
form.resetFields();
|
||||
onClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<AppModal
|
||||
open={open}
|
||||
title={item ? "编辑灵感" : "新建灵感"}
|
||||
width={720}
|
||||
onCancel={() => { form.resetFields(); onClose(); }}
|
||||
afterOpenChange={(visible) => { if (visible) form.setFieldsValue(toFormValues(item)); }}
|
||||
footer={
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button onClick={() => { form.resetFields(); onClose(); }}>取消</Button>
|
||||
<Button type="primary" onClick={() => void handleOk()}>{item ? "保存" : "创建"}</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Form form={form} layout="vertical" initialValues={toFormValues(item)} preserve={false}>
|
||||
{/* 字段较多,不限高的话底部按钮会被顶出视口,提交就点不到了。 */}
|
||||
<div className="max-h-[64vh] overflow-y-auto pr-1">
|
||||
<Form.Item name="title" label="标题" rules={[{ required: true, message: "请填写标题" }]}>
|
||||
<Input placeholder="例如:护肤品质感广告主视觉" maxLength={80} />
|
||||
</Form.Item>
|
||||
<Form.Item name="description" label="一句话描述">
|
||||
<Input placeholder="卡片上铺两行,说明这个提示词适合做什么" maxLength={120} />
|
||||
</Form.Item>
|
||||
<Form.Item name="image" label="封面地址" rules={[{ required: true, message: "请填写封面图片地址" }]}>
|
||||
<Input placeholder="https:// 开头的图片地址,或 /public 下的本地路径" />
|
||||
</Form.Item>
|
||||
<div className="grid gap-x-4 sm:grid-cols-3">
|
||||
<Form.Item name="mode" label="创作类型" rules={[{ required: true }]}>
|
||||
<Select
|
||||
options={[
|
||||
{ label: "图片", value: "image" },
|
||||
{ label: "视频", value: "video" },
|
||||
{ label: "文本", value: "text" },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item name="category" label="分类">
|
||||
<Select allowClear showSearch placeholder="选一个或留空" options={categoryOptions} />
|
||||
</Form.Item>
|
||||
<Form.Item name="ratio" label="画面比例">
|
||||
<Input placeholder="例如 16:9" maxLength={12} />
|
||||
</Form.Item>
|
||||
</div>
|
||||
<Form.Item name="tags" label="标签" extra="用逗号分隔,最多六个">
|
||||
<Input placeholder="电商产品,海报排版" maxLength={120} />
|
||||
</Form.Item>
|
||||
<Form.Item name="prompt" label="提示词正文" rules={[{ required: true, message: "请填写提示词正文" }]}>
|
||||
<Input.TextArea rows={6} placeholder="粘贴完整提示词;外部英文提示词也可以直接放这里" />
|
||||
</Form.Item>
|
||||
<Form.Item name="promptZh" label="中文正文(可选)" extra="填了以后,卡片和「用这个创意创作」会优先用中文这版">
|
||||
<Input.TextArea rows={4} placeholder="中文改写版,留空则只用上面的正文" />
|
||||
</Form.Item>
|
||||
</div>
|
||||
</Form>
|
||||
</AppModal>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
/* 灵感库画廊。卡片是主体:封面占满、信息压在底部、悬停整体抬起来。
|
||||
颜色、圆角、阴影一律走项目 token,不写字面值。 */
|
||||
|
||||
.inspiration-gallery {
|
||||
display: grid;
|
||||
gap: var(--space-4, 16px);
|
||||
grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
|
||||
}
|
||||
|
||||
.inspiration-card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
/* 玻璃质感:亮描边 + 大而软的投影,和首页纵深画廊同一套语言。 */
|
||||
border: 1px solid color-mix(in srgb, var(--user-ink) 9%, transparent);
|
||||
border-radius: var(--r-2xl, 16px);
|
||||
background: var(--creation-surface, var(--user-surface));
|
||||
box-shadow: 0 12px 28px -20px color-mix(in srgb, var(--user-ink) 42%, transparent);
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
transform var(--user-motion, 180ms) cubic-bezier(.2, .8, .3, 1),
|
||||
box-shadow var(--user-motion, 180ms) ease,
|
||||
border-color var(--user-motion, 180ms) ease;
|
||||
}
|
||||
|
||||
.inspiration-card:hover,
|
||||
.inspiration-card:focus-visible {
|
||||
border-color: color-mix(in srgb, var(--user-ink) 18%, transparent);
|
||||
box-shadow: 0 24px 44px -24px color-mix(in srgb, var(--user-ink) 52%, transparent);
|
||||
transform: translateY(-3px);
|
||||
}
|
||||
|
||||
.inspiration-card:focus-visible {
|
||||
outline: 2px solid var(--user-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.inspiration-card-cover {
|
||||
position: relative;
|
||||
aspect-ratio: 4 / 3;
|
||||
overflow: hidden;
|
||||
background: var(--user-surface-muted);
|
||||
}
|
||||
|
||||
.inspiration-card-cover img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: transform 420ms cubic-bezier(.2, .8, .3, 1);
|
||||
}
|
||||
|
||||
.inspiration-card:hover .inspiration-card-cover img {
|
||||
transform: scale(1.045);
|
||||
}
|
||||
|
||||
/* 封面底部压一层暗角,让源标签始终读得清。 */
|
||||
.inspiration-card-cover::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: auto 0 0;
|
||||
height: 46%;
|
||||
background: linear-gradient(transparent, rgba(0, 0, 0, .58));
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.inspiration-card-cover .inspiration-card-source {
|
||||
position: absolute;
|
||||
bottom: var(--space-2, 8px);
|
||||
left: var(--space-2, 8px);
|
||||
z-index: 1;
|
||||
padding: 3px var(--space-2, 8px);
|
||||
border-radius: var(--r-full, 999px);
|
||||
background: rgba(20, 22, 26, .48);
|
||||
color: #fff;
|
||||
font-size: var(--fs-tiny, 10px);
|
||||
line-height: 1.6;
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
/* 悬停才浮出的快捷操作,平时不干扰画面。 */
|
||||
.inspiration-card-actions {
|
||||
position: absolute;
|
||||
top: var(--space-2, 8px);
|
||||
right: var(--space-2, 8px);
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
gap: var(--space-1, 4px);
|
||||
opacity: 0;
|
||||
transition: opacity var(--user-motion, 180ms) ease;
|
||||
}
|
||||
|
||||
.inspiration-card:hover .inspiration-card-actions,
|
||||
.inspiration-card:focus-within .inspiration-card-actions {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.inspiration-card-action {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
color: #fff;
|
||||
background: rgba(20, 22, 26, .5);
|
||||
border: 1px solid rgba(255, 255, 255, .18);
|
||||
border-radius: var(--r-full, 999px);
|
||||
cursor: pointer;
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
backdrop-filter: blur(10px);
|
||||
transition: background-color var(--user-motion, 180ms) ease;
|
||||
}
|
||||
|
||||
.inspiration-card-action:hover {
|
||||
background: rgba(20, 22, 26, .72);
|
||||
}
|
||||
|
||||
.inspiration-card-action.is-on {
|
||||
color: var(--user-accent);
|
||||
background: color-mix(in srgb, var(--user-surface) 88%, transparent);
|
||||
}
|
||||
|
||||
.inspiration-card-body {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: var(--space-1, 4px);
|
||||
padding: var(--space-3, 12px);
|
||||
}
|
||||
|
||||
.inspiration-card-title {
|
||||
overflow: hidden;
|
||||
color: var(--user-ink);
|
||||
font-size: var(--fs-body, 14px);
|
||||
font-weight: 600;
|
||||
line-height: 1.35;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.inspiration-card-desc {
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
color: var(--user-ink-soft);
|
||||
font-size: var(--fs-caption, 12px);
|
||||
line-height: 1.5;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.inspiration-card-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-1, 4px);
|
||||
margin-top: var(--space-1, 4px);
|
||||
}
|
||||
|
||||
/* 分类标签。未选中态必须有看得出边界的底色:
|
||||
页面本身是纯白,只给 #f1f1f3 这种 4% 差的浅灰等于没给,整排会糊成"一片白按钮"。 */
|
||||
.inspiration-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1, 4px);
|
||||
padding: var(--space-1, 4px) var(--space-3, 12px);
|
||||
color: var(--user-ink, #1d1d21);
|
||||
background: color-mix(in srgb, var(--user-ink, #1d1d21) 12%, var(--user-surface, #fff));
|
||||
border: 1px solid color-mix(in srgb, var(--user-ink, #1d1d21) 22%, transparent);
|
||||
border-radius: var(--r-full, 999px);
|
||||
font-size: var(--fs-caption, 12px);
|
||||
line-height: 1.7;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
color var(--user-motion, 180ms) ease,
|
||||
background-color var(--user-motion, 180ms) ease,
|
||||
border-color var(--user-motion, 180ms) ease;
|
||||
}
|
||||
|
||||
.inspiration-chip:hover {
|
||||
background: color-mix(in srgb, var(--user-ink, #1d1d21) 18%, var(--user-surface, #fff));
|
||||
border-color: color-mix(in srgb, var(--user-ink, #1d1d21) 34%, transparent);
|
||||
}
|
||||
|
||||
.inspiration-chip[aria-pressed="true"] {
|
||||
color: var(--user-surface, #fff);
|
||||
background: var(--user-ink, #1d1d21);
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
.inspiration-chip:focus-visible {
|
||||
outline: 2px solid var(--user-accent, #5f55d9);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* 标签里的计数:比正文弱一档,但仍要在两种底色上都读得出来。 */
|
||||
.inspiration-chip-count {
|
||||
font-variant-numeric: tabular-nums;
|
||||
opacity: .58;
|
||||
}
|
||||
|
||||
/* 卡片上的分类/署名标签是纯展示,不参与点击,去掉指针与悬停反馈。 */
|
||||
.inspiration-card-tags .inspiration-chip {
|
||||
padding: 1px var(--space-2, 8px);
|
||||
font-size: var(--fs-tiny, 10px);
|
||||
background: var(--user-surface-muted, #f1f1f3);
|
||||
border-color: color-mix(in srgb, var(--user-ink, #1d1d21) 12%, transparent);
|
||||
color: color-mix(in srgb, var(--user-ink, #1d1d21) 72%, transparent);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.inspiration-card-tags .inspiration-chip:hover {
|
||||
background: var(--user-surface-muted, #f1f1f3);
|
||||
border-color: color-mix(in srgb, var(--user-ink, #1d1d21) 12%, transparent);
|
||||
}
|
||||
|
||||
/* 详情与列表里的纯图标按钮。带 span 是为了避开 workspace-product.css 里
|
||||
那条 `button:has(> svg):not(:has(> span))` 的全局浮起规则,这里的悬停是自定义的。 */
|
||||
.inspiration-icon-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
padding: 0;
|
||||
color: var(--user-ink-soft);
|
||||
background: transparent;
|
||||
border: 1px solid color-mix(in srgb, var(--user-ink) 12%, transparent);
|
||||
border-radius: var(--r-full, 999px);
|
||||
cursor: pointer;
|
||||
transition:
|
||||
color var(--user-motion, 180ms) ease,
|
||||
background-color var(--user-motion, 180ms) ease,
|
||||
border-color var(--user-motion, 180ms) ease;
|
||||
}
|
||||
|
||||
.inspiration-icon-button:hover {
|
||||
color: var(--user-ink);
|
||||
background: var(--user-surface-muted);
|
||||
border-color: color-mix(in srgb, var(--user-ink) 20%, transparent);
|
||||
}
|
||||
|
||||
.inspiration-icon-button[aria-pressed="true"] {
|
||||
color: var(--user-accent);
|
||||
border-color: color-mix(in srgb, var(--user-accent) 42%, transparent);
|
||||
}
|
||||
|
||||
.inspiration-icon-button:focus-visible {
|
||||
outline: 2px solid var(--user-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* 提示词正文:等宽、可滚动、保留换行,复制按钮钉在右上角。 */
|
||||
.inspiration-prompt-block {
|
||||
position: relative;
|
||||
max-height: 320px;
|
||||
padding: var(--space-3, 12px);
|
||||
overflow: auto;
|
||||
border: 1px solid color-mix(in srgb, var(--user-ink) 10%, transparent);
|
||||
border-radius: var(--r-lg, 12px);
|
||||
background: var(--user-surface-muted);
|
||||
color: var(--user-ink);
|
||||
font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
|
||||
font-size: var(--fs-caption, 12px);
|
||||
line-height: 1.7;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.inspiration-card,
|
||||
.inspiration-card-cover img {
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.inspiration-card:hover,
|
||||
.inspiration-card:focus-visible {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.inspiration-card:hover .inspiration-card-cover img {
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user