style: format constants.ts with prettier (#1899 #1900)

This commit is contained in:
2026-09-14 21:28:57 +08:00
parent f14a83ff35
commit 8fcb0c99b0
+233 -51
View File
@@ -2,14 +2,17 @@
* 智能剪辑页面 — 常量定义
*/
import type { CoverConfig } from "./types/cover"
import type { CoverConfig } from "./types/cover";
/* ── 克隆声音状态配置 ── */
export const CLONE_STATUS_CONFIG: Record<string, { label: string; color: string }> = {
export const CLONE_STATUS_CONFIG: Record<
string,
{ label: string; color: string }
> = {
ready: { label: "就绪", color: "var(--secondary-color, #10b981)" },
processing: { label: "克隆中", color: "var(--accent-color, #f59e0b)" },
failed: { label: "失败", color: "var(--error-color, #ef4444)" },
}
};
/* ── 模板渐变色映射(根据 mode 分配视觉样式) ── */
export const MODE_GRADIENTS: Record<string, string> = {
@@ -17,7 +20,7 @@ export const MODE_GRADIENTS: Record<string, string> = {
one_take: "linear-gradient(135deg, #3b82f6, #1d4ed8)",
voice_over: "linear-gradient(135deg, #6366f1, #4f46e5)",
voice_pip: "linear-gradient(135deg, #10b981, #059669)",
}
};
/* ── 配音性别图标 ── */
export const VOICE_GENDER_ICON: Record<string, string> = {
@@ -25,7 +28,7 @@ export const VOICE_GENDER_ICON: Record<string, string> = {
male: "🎙️",
child: "🧒",
neutral: "✨",
}
};
/* ── 步骤定义(5步,#1899 简化:删除选模板步骤) ── */
export const STEPS = [
@@ -34,17 +37,17 @@ export const STEPS = [
{ key: 3, label: "选择标题" },
{ key: 4, label: "确认生成" },
{ key: 5, label: "选择封面" },
]
];
/* ── 片段数量配置(#1899) ── */
export const DEFAULT_CLIP_COUNT = 3
export const MIN_CLIP_COUNT = 1
export const MAX_CLIP_COUNT = 10
export const CLIP_COUNT_STEP = 1
export const DEFAULT_CLIP_COUNT = 3;
export const MIN_CLIP_COUNT = 1;
export const MAX_CLIP_COUNT = 10;
export const CLIP_COUNT_STEP = 1;
/* ── 批量生成限制 ── */
export const MAX_PREVIEW_COUNT = 10
export const MIN_PREVIEW_COUNT = 1
export const MAX_PREVIEW_COUNT = 10;
export const MIN_PREVIEW_COUNT = 1;
/* ── 标题位置选项 ── */
export const POSITION_OPTIONS = [
@@ -52,23 +55,31 @@ export const POSITION_OPTIONS = [
{ value: "center", label: "居中" },
{ value: "bottom", label: "底部" },
{ value: "custom", label: "自定义" },
]
];
/* ── 标题字体选项 ── */
export const FONT_OPTIONS = ["思源黑体", "思源宋体", "苹方", "微软雅黑", "楷体"]
export const FONT_OPTIONS = [
"思源黑体",
"思源宋体",
"苹方",
"微软雅黑",
"楷体",
];
/* ── 标题字体 CSS font-family 映射(中文显示名 → 浏览器可识别的字体栈) ── */
export const FONT_FAMILY_MAP: Record<string, string> = {
思源黑体: '"Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif',
思源宋体: '"Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun", serif',
思源黑体:
'"Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif',
思源宋体:
'"Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun", serif',
苹方: '"PingFang SC", -apple-system, "Helvetica Neue", sans-serif',
PingFang: '"PingFang SC", -apple-system, "Helvetica Neue", sans-serif',
微软雅黑: '"Microsoft YaHei", "PingFang SC", sans-serif',
楷体: '"KaiTi", "STKaiti", "DFKai-SB", serif',
}
};
export function getFontFamily(font: string): string {
return FONT_FAMILY_MAP[font] || FONT_FAMILY_MAP["思源黑体"]
return FONT_FAMILY_MAP[font] || FONT_FAMILY_MAP["思源黑体"];
}
/* ── 标题样式预设 ── */
@@ -76,7 +87,14 @@ export const TITLE_PRESETS = [
{
key: "classic_white",
label: "经典白字",
style: { size: 28, color: "#ffffff", bold: true, italic: false, stroke: true, shadow: false },
style: {
size: 28,
color: "#ffffff",
bold: true,
italic: false,
stroke: true,
shadow: false,
},
previewStyle: {
color: "#ffffff",
_strokeColor: "#000000",
@@ -88,7 +106,14 @@ export const TITLE_PRESETS = [
{
key: "black_gold",
label: "黑金质感",
style: { size: 32, color: "#d4a843", bold: true, italic: false, stroke: false, shadow: true },
style: {
size: 32,
color: "#d4a843",
bold: true,
italic: false,
stroke: false,
shadow: true,
},
previewStyle: {
color: "#d4a843",
fontWeight: 700,
@@ -99,7 +124,14 @@ export const TITLE_PRESETS = [
{
key: "fresh_minimal",
label: "清新简约",
style: { size: 24, color: "#333333", bold: false, italic: false, stroke: false, shadow: false },
style: {
size: 24,
color: "#333333",
bold: false,
italic: false,
stroke: false,
shadow: false,
},
previewStyle: {
color: "#e8e8e8",
fontWeight: 400,
@@ -109,7 +141,14 @@ export const TITLE_PRESETS = [
{
key: "variety_show",
label: "综艺花字",
style: { size: 36, color: "#ff4081", bold: true, italic: false, stroke: true, shadow: true },
style: {
size: 36,
color: "#ff4081",
bold: true,
italic: false,
stroke: true,
shadow: true,
},
previewStyle: {
color: "#ff4081",
_strokeColor: "#ffffff",
@@ -122,7 +161,14 @@ export const TITLE_PRESETS = [
{
key: "business",
label: "商务极简",
style: { size: 24, color: "#1a1a1a", bold: false, italic: false, stroke: false, shadow: false },
style: {
size: 24,
color: "#1a1a1a",
bold: false,
italic: false,
stroke: false,
shadow: false,
},
previewStyle: {
color: "#e0e0e0",
fontWeight: 400,
@@ -132,7 +178,14 @@ export const TITLE_PRESETS = [
{
key: "retro_film",
label: "复古胶片",
style: { size: 28, color: "#e8d5b7", bold: false, italic: false, stroke: false, shadow: true },
style: {
size: 28,
color: "#e8d5b7",
bold: false,
italic: false,
stroke: false,
shadow: true,
},
previewStyle: {
color: "#e8d5b7",
fontWeight: 400,
@@ -143,18 +196,33 @@ export const TITLE_PRESETS = [
{
key: "neon_glow",
label: "霓虹发光",
style: { size: 32, color: "#00e5ff", bold: true, italic: false, stroke: false, shadow: true },
style: {
size: 32,
color: "#00e5ff",
bold: true,
italic: false,
stroke: false,
shadow: true,
},
previewStyle: {
color: "#00e5ff",
fontWeight: 700,
fontSize: "32px",
textShadow: "0 0 4px #00e5ff, 0 0 8px #00e5ff, 0 0 16px rgba(0,229,255,0.5)",
textShadow:
"0 0 4px #00e5ff, 0 0 8px #00e5ff, 0 0 16px rgba(0,229,255,0.5)",
},
},
{
key: "handwriting",
label: "手写字",
style: { size: 28, color: "#333333", bold: false, italic: false, stroke: false, shadow: true },
style: {
size: 28,
color: "#333333",
bold: false,
italic: false,
stroke: false,
shadow: true,
},
previewStyle: {
color: "#e0e0e0",
fontWeight: 400,
@@ -165,7 +233,14 @@ export const TITLE_PRESETS = [
{
key: "outline_yellow",
label: "黄色描边",
style: { size: 28, color: "#ffd54f", bold: true, italic: false, stroke: true, shadow: false },
style: {
size: 28,
color: "#ffd54f",
bold: true,
italic: false,
stroke: true,
shadow: false,
},
previewStyle: {
color: "#ffd54f",
_strokeColor: "#000000",
@@ -177,7 +252,14 @@ export const TITLE_PRESETS = [
{
key: "outline_pink",
label: "粉色描边",
style: { size: 28, color: "#ff80ab", bold: true, italic: false, stroke: true, shadow: false },
style: {
size: 28,
color: "#ff80ab",
bold: true,
italic: false,
stroke: true,
shadow: false,
},
previewStyle: {
color: "#ff80ab",
_strokeColor: "#000000",
@@ -189,7 +271,14 @@ export const TITLE_PRESETS = [
{
key: "outline_blue",
label: "蓝色描边",
style: { size: 28, color: "#82b1ff", bold: true, italic: false, stroke: true, shadow: false },
style: {
size: 28,
color: "#82b1ff",
bold: true,
italic: false,
stroke: true,
shadow: false,
},
previewStyle: {
color: "#82b1ff",
_strokeColor: "#000000",
@@ -201,7 +290,14 @@ export const TITLE_PRESETS = [
{
key: "outline_green",
label: "绿色描边",
style: { size: 28, color: "#69f0ae", bold: true, italic: false, stroke: true, shadow: false },
style: {
size: 28,
color: "#69f0ae",
bold: true,
italic: false,
stroke: true,
shadow: false,
},
previewStyle: {
color: "#69f0ae",
_strokeColor: "#000000",
@@ -213,7 +309,14 @@ export const TITLE_PRESETS = [
{
key: "outline_gray",
label: "灰色描边",
style: { size: 28, color: "#bdbdbd", bold: true, italic: false, stroke: true, shadow: false },
style: {
size: 28,
color: "#bdbdbd",
bold: true,
italic: false,
stroke: true,
shadow: false,
},
previewStyle: {
color: "#bdbdbd",
_strokeColor: "#000000",
@@ -225,7 +328,14 @@ export const TITLE_PRESETS = [
{
key: "bg_white",
label: "白底黑字",
style: { size: 28, color: "#1a1a1a", bold: true, italic: false, stroke: false, shadow: false },
style: {
size: 28,
color: "#1a1a1a",
bold: true,
italic: false,
stroke: false,
shadow: false,
},
previewStyle: {
color: "#1a1a1a",
fontWeight: 700,
@@ -238,7 +348,14 @@ export const TITLE_PRESETS = [
{
key: "bg_yellow",
label: "黄底黑字",
style: { size: 28, color: "#1a1a1a", bold: true, italic: false, stroke: false, shadow: false },
style: {
size: 28,
color: "#1a1a1a",
bold: true,
italic: false,
stroke: false,
shadow: false,
},
previewStyle: {
color: "#1a1a1a",
fontWeight: 700,
@@ -251,7 +368,14 @@ export const TITLE_PRESETS = [
{
key: "bg_pink",
label: "粉底黑字",
style: { size: 28, color: "#1a1a1a", bold: true, italic: false, stroke: false, shadow: false },
style: {
size: 28,
color: "#1a1a1a",
bold: true,
italic: false,
stroke: false,
shadow: false,
},
previewStyle: {
color: "#1a1a1a",
fontWeight: 700,
@@ -264,7 +388,14 @@ export const TITLE_PRESETS = [
{
key: "bg_red",
label: "红底白字",
style: { size: 28, color: "#ffffff", bold: true, italic: false, stroke: false, shadow: false },
style: {
size: 28,
color: "#ffffff",
bold: true,
italic: false,
stroke: false,
shadow: false,
},
previewStyle: {
color: "#ffffff",
fontWeight: 700,
@@ -277,29 +408,52 @@ export const TITLE_PRESETS = [
{
key: "neon_orange",
label: "橙色发光",
style: { size: 32, color: "#ff9100", bold: true, italic: false, stroke: false, shadow: true },
style: {
size: 32,
color: "#ff9100",
bold: true,
italic: false,
stroke: false,
shadow: true,
},
previewStyle: {
color: "#ff9100",
fontWeight: 700,
fontSize: "32px",
textShadow: "0 0 4px #ff9100, 0 0 8px #ff9100, 0 0 16px rgba(255,145,0,0.5)",
textShadow:
"0 0 4px #ff9100, 0 0 8px #ff9100, 0 0 16px rgba(255,145,0,0.5)",
},
},
{
key: "neon_purple",
label: "紫色发光",
style: { size: 32, color: "#d500f9", bold: true, italic: false, stroke: false, shadow: true },
style: {
size: 32,
color: "#d500f9",
bold: true,
italic: false,
stroke: false,
shadow: true,
},
previewStyle: {
color: "#d500f9",
fontWeight: 700,
fontSize: "32px",
textShadow: "0 0 4px #d500f9, 0 0 8px #d500f9, 0 0 16px rgba(213,0,249,0.5)",
textShadow:
"0 0 4px #d500f9, 0 0 8px #d500f9, 0 0 16px rgba(213,0,249,0.5)",
},
},
{
key: "bordered_white",
label: "白字绿框",
style: { size: 28, color: "#ffffff", bold: true, italic: false, stroke: false, shadow: false },
style: {
size: 28,
color: "#ffffff",
bold: true,
italic: false,
stroke: false,
shadow: false,
},
previewStyle: {
color: "#ffffff",
fontWeight: 700,
@@ -313,7 +467,14 @@ export const TITLE_PRESETS = [
{
key: "gradient_warm",
label: "暖色渐变",
style: { size: 32, color: "#ff6d00", bold: true, italic: false, stroke: false, shadow: true },
style: {
size: 32,
color: "#ff6d00",
bold: true,
italic: false,
stroke: false,
shadow: true,
},
previewStyle: {
color: "#ff6d00",
fontWeight: 700,
@@ -324,7 +485,14 @@ export const TITLE_PRESETS = [
{
key: "gradient_cool",
label: "冷色渐变",
style: { size: 32, color: "#00b0ff", bold: true, italic: false, stroke: false, shadow: true },
style: {
size: 32,
color: "#00b0ff",
bold: true,
italic: false,
stroke: false,
shadow: true,
},
previewStyle: {
color: "#00b0ff",
fontWeight: 700,
@@ -335,7 +503,14 @@ export const TITLE_PRESETS = [
{
key: "shadow_deep",
label: "深影白字",
style: { size: 28, color: "#ffffff", bold: true, italic: false, stroke: false, shadow: true },
style: {
size: 28,
color: "#ffffff",
bold: true,
italic: false,
stroke: false,
shadow: true,
},
previewStyle: {
color: "#ffffff",
fontWeight: 700,
@@ -346,7 +521,14 @@ export const TITLE_PRESETS = [
{
key: "soft_gold",
label: "柔光金",
style: { size: 28, color: "#ffd54f", bold: true, italic: false, stroke: false, shadow: true },
style: {
size: 28,
color: "#ffd54f",
bold: true,
italic: false,
stroke: false,
shadow: true,
},
previewStyle: {
color: "#ffd54f",
fontWeight: 700,
@@ -354,20 +536,20 @@ export const TITLE_PRESETS = [
textShadow: "0 0 6px rgba(255,213,79,0.5), 1px 1px 2px rgba(0,0,0,0.4)",
},
},
]
];
/* ── 封面模式 ── */
export const COVER_MODE_LABELS: Record<string, string> = {
auto: "智能封面",
frame: "抽帧选封面",
upload: "上传封面",
}
};
export const COVER_MODE_ICONS: Record<string, string> = {
auto: "🤖",
frame: "🎞️",
upload: "📤",
}
};
/* ── 智能匹配推荐理由 ── */
export const SMART_MATCH_REASONS = [
@@ -379,7 +561,7 @@ export const SMART_MATCH_REASONS = [
"镜头运动流畅自然",
"光影效果出色",
"人物表情生动",
]
];
/* ── AI 标题模板 ── */
export const AI_TITLE_TEMPLATES: Record<string, string[]> = {
@@ -404,7 +586,7 @@ export const AI_TITLE_TEMPLATES: Record<string, string[]> = {
"三分钟带你全面了解{topic}",
"{topic}常见问题与解决方案汇总",
],
}
};
/* ── 默认封面设置 ── */
export const DEFAULT_COVER_SETTINGS: CoverConfig = {
@@ -414,4 +596,4 @@ export const DEFAULT_COVER_SETTINGS: CoverConfig = {
upload_url: "",
ai_suggested_time: null,
thumbnail_url: "",
}
};