refactor(editing-planner): 拆分 types.ts 为目录结构,按功能模块分文件
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 24s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m14s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m14s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 45s
CI/CD Pipeline / Validate - Code Quality (pull_request) Failing after 1m47s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 39s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m5s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 1m12s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 56s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m55s
AI Code Review / AI Code Review (pull_request) Successful in 3m55s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 6m21s
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 27s
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 24s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 1m14s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 1m14s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 45s
CI/CD Pipeline / Validate - Code Quality (pull_request) Failing after 1m47s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 39s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m5s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 1m12s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 56s
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m55s
AI Code Review / AI Code Review (pull_request) Successful in 3m55s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 6m21s
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 27s
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
原 types.ts 单文件 550 行,按功能拆分为 14 个模块文件: - transition: 转场特效 - speed: 片段调速 - tts: TTS 配音 - trim: 片段裁剪 - watermark: 水印配置 - intro-outro: 片头片尾 - pip: 混剪 PiP - filter: 滤镜调色 - chroma-key: 绿幕抠像 - sticker: 贴纸配置 - cover: 封面配置 - clip: 片段数据 - title: 标题设置 - subtitle: 字幕样式(原有) - clipProperties: ClipPropertiesPanel 专属类型(原有) index.ts 统一 re-export,保持 @/pages/editing-planner/types 导入路径向后兼容
This commit is contained in:
@@ -1,550 +0,0 @@
|
||||
/**
|
||||
* 片段(Clip)统一类型定义
|
||||
* 片段 = 时间规划 + 类型标记,不绑定任何素材
|
||||
*/
|
||||
|
||||
export type ClipType = "voice" | "pip"
|
||||
|
||||
/* ──────── 转场特效 ──────── */
|
||||
|
||||
/** 14 种转场类型 */
|
||||
export type TransitionType =
|
||||
| "none"
|
||||
| "cut"
|
||||
| "fade"
|
||||
| "dissolve"
|
||||
| "zoom"
|
||||
| "slide_left"
|
||||
| "slide_right"
|
||||
| "slide_up"
|
||||
| "slide_down"
|
||||
| "wipe_left"
|
||||
| "wipe_right"
|
||||
| "wipe_up"
|
||||
| "wipe_down"
|
||||
| "circlecrop"
|
||||
| "rectcrop"
|
||||
|
||||
/** 片段间转场配置 */
|
||||
export interface TransitionConfig {
|
||||
/** 转场类型 */
|
||||
type: TransitionType
|
||||
/** 转场时长(秒),0.3 ~ 2.0 */
|
||||
duration: number
|
||||
}
|
||||
|
||||
/** 默认转场配置 */
|
||||
export const DEFAULT_TRANSITION: TransitionConfig = {
|
||||
type: "none",
|
||||
duration: 0.5,
|
||||
}
|
||||
|
||||
/* ──────── 片段调速 ──────── */
|
||||
|
||||
/** 片段调速配置 */
|
||||
export interface SpeedConfig {
|
||||
/** 播放速度,0.25 ~ 4.0 */
|
||||
rate: number
|
||||
/** 音调修正(变速不变调) */
|
||||
pitchCorrection: boolean
|
||||
}
|
||||
|
||||
/** 默认调速配置 */
|
||||
export const DEFAULT_SPEED: SpeedConfig = {
|
||||
rate: 1.0,
|
||||
pitchCorrection: true,
|
||||
}
|
||||
|
||||
/* ──────── TTS 配音 ──────── */
|
||||
|
||||
/** 配音模式 */
|
||||
export type TtsMode = "none" | "upload" | "tts"
|
||||
|
||||
/** TTS 配音配置 */
|
||||
export interface TtsConfig {
|
||||
/** 配音模式 */
|
||||
mode: TtsMode
|
||||
/** TTS 合成文本 */
|
||||
text: string
|
||||
/** 音色 ID */
|
||||
voice_id: string
|
||||
/** 语速 0.5 ~ 2.0 */
|
||||
speed: number
|
||||
/** 语调(半音)-12 ~ +12 */
|
||||
pitch: number
|
||||
/** 音量 0 ~ 100 */
|
||||
volume: number
|
||||
/** 字幕联动 */
|
||||
subtitle_sync: boolean
|
||||
}
|
||||
|
||||
/** 默认 TTS 配置 */
|
||||
export const DEFAULT_TTS_CONFIG: TtsConfig = {
|
||||
mode: "none",
|
||||
text: "",
|
||||
voice_id: "",
|
||||
speed: 1.0,
|
||||
pitch: 0,
|
||||
volume: 100,
|
||||
subtitle_sync: true,
|
||||
}
|
||||
|
||||
/* ──────── 裁剪配置 ──────── */
|
||||
|
||||
/** 片段裁剪配置 — 定义素材的入点/出点 */
|
||||
export interface TrimConfig {
|
||||
/** 入点(秒),素材原始时间轴上的起始位置 */
|
||||
start_time: number
|
||||
/** 出点(秒),素材原始时间轴上的结束位置 */
|
||||
end_time: number
|
||||
/** 素材原始总时长(秒),用于"恢复原始长度" */
|
||||
original_duration?: number
|
||||
}
|
||||
|
||||
/* ──────── 水印配置 ──────── */
|
||||
|
||||
/** 水印类型 */
|
||||
export type WatermarkType = "none" | "image" | "text" | "scroll"
|
||||
|
||||
/** 水印位置 */
|
||||
export type WatermarkPosition = "top_left" | "top_right" | "bottom_left" | "bottom_right" | "center"
|
||||
|
||||
/** 滚动水印方向 */
|
||||
export type ScrollDirection = "horizontal" | "vertical" | "diagonal"
|
||||
|
||||
/** 水印配置 */
|
||||
export interface WatermarkConfig {
|
||||
/** 水印类型 */
|
||||
type: WatermarkType
|
||||
/** 图片水印 URL */
|
||||
image_url?: string
|
||||
/** 水印宽度(像素或百分比 0~1) */
|
||||
width?: number
|
||||
/** 水印高度(像素或百分比 0~1) */
|
||||
height?: number
|
||||
/** 水印位置 */
|
||||
position: WatermarkPosition
|
||||
/** 水印不透明度 0~1 */
|
||||
opacity: number
|
||||
/** 文字水印内容 */
|
||||
text?: string
|
||||
/** 文字水印字号 */
|
||||
font_size?: number
|
||||
/** 文字水印颜色 */
|
||||
color?: string
|
||||
/** 滚动水印方向 */
|
||||
scroll_direction?: ScrollDirection
|
||||
/** 滚动水印速度(像素/秒) */
|
||||
scroll_speed?: number
|
||||
}
|
||||
|
||||
/** 默认水印配置 */
|
||||
export const DEFAULT_WATERMARK: WatermarkConfig = {
|
||||
type: "none",
|
||||
position: "bottom_right",
|
||||
opacity: 0.7,
|
||||
}
|
||||
|
||||
/* ──────── 片头片尾配置 ──────── */
|
||||
|
||||
/** 片头片尾素材类型 */
|
||||
export type IntroOutroKind = "none" | "video" | "image"
|
||||
|
||||
/** 片头/片尾单项配置 */
|
||||
export interface IntroOutroItem {
|
||||
/** 素材类型 */
|
||||
kind: IntroOutroKind
|
||||
/** 素材 URL */
|
||||
url?: string
|
||||
/** 显示时长(秒) */
|
||||
duration: number
|
||||
/** 过渡动画 */
|
||||
transition?: TransitionType
|
||||
/** 过渡时长(秒) */
|
||||
transition_duration?: number
|
||||
}
|
||||
|
||||
/** 片头片尾完整配置 */
|
||||
export interface IntroOutroConfig {
|
||||
intro: IntroOutroItem
|
||||
outro: IntroOutroItem
|
||||
}
|
||||
|
||||
/** 默认片头片尾配置 */
|
||||
export const DEFAULT_INTRO_OUTRO: IntroOutroConfig = {
|
||||
intro: { kind: "none", duration: 3 },
|
||||
outro: { kind: "none", duration: 3 },
|
||||
}
|
||||
|
||||
/* ──────── 混剪配置 ──────── */
|
||||
|
||||
/** 九宫格位置 */
|
||||
export type PipGridPosition =
|
||||
| "top_left"
|
||||
| "top_center"
|
||||
| "top_right"
|
||||
| "center_left"
|
||||
| "center"
|
||||
| "center_right"
|
||||
| "bottom_left"
|
||||
| "bottom_center"
|
||||
| "bottom_right"
|
||||
|
||||
/** 入场动画类型 */
|
||||
export type PipAnimType = "none" | "fade_in" | "slide_in"
|
||||
|
||||
/** 入场方向 */
|
||||
export type PipSlideDirection = "left" | "right" | "up" | "down"
|
||||
|
||||
/** 混剪图层 */
|
||||
export interface PipLayer {
|
||||
id: string
|
||||
/** 图层名称(用户可编辑) */
|
||||
name: string
|
||||
/** 素材类型 */
|
||||
material_type: "image" | "video"
|
||||
/** 素材 URL */
|
||||
material_url: string
|
||||
/** 素材缩略图 */
|
||||
thumbnail_url?: string
|
||||
/** 九宫格快捷位置 */
|
||||
grid_position: PipGridPosition
|
||||
/** 精确 X 坐标(百分比 0~100) */
|
||||
x: number
|
||||
/** 精确 Y 坐标(百分比 0~100) */
|
||||
y: number
|
||||
/** 宽度(百分比 0~100,相对主画面) */
|
||||
width: number
|
||||
/** 高度(百分比 0~100,相对主画面) */
|
||||
height: number
|
||||
/** 锁定宽高比 */
|
||||
aspect_lock: boolean
|
||||
/** 圆角(百分比 0~50) */
|
||||
border_radius: number
|
||||
/** 不透明度(0~100) */
|
||||
opacity: number
|
||||
/** 开始时间(秒) */
|
||||
start_time: number
|
||||
/** 持续时长(秒) */
|
||||
duration: number
|
||||
/** 入场动画 */
|
||||
animation: PipAnimType
|
||||
/** 入场方向 */
|
||||
slide_direction: PipSlideDirection
|
||||
/** 图层顺序(z-index) */
|
||||
z_index: number
|
||||
}
|
||||
|
||||
/** 混剪配置 */
|
||||
export interface PipConfig {
|
||||
/** 是否启用混剪 */
|
||||
enabled: boolean
|
||||
/** 图层列表 */
|
||||
layers: PipLayer[]
|
||||
}
|
||||
|
||||
/** 默认 PiP 图层 */
|
||||
export const DEFAULT_PIP_LAYER: PipLayer = {
|
||||
id: "",
|
||||
name: "图层",
|
||||
material_type: "image",
|
||||
material_url: "",
|
||||
grid_position: "top_right",
|
||||
x: 70,
|
||||
y: 5,
|
||||
width: 25,
|
||||
height: 25,
|
||||
aspect_lock: true,
|
||||
border_radius: 0,
|
||||
opacity: 100,
|
||||
start_time: 0,
|
||||
duration: 5,
|
||||
animation: "none",
|
||||
slide_direction: "right",
|
||||
z_index: 1,
|
||||
}
|
||||
|
||||
/** 默认 PiP 配置 */
|
||||
export const DEFAULT_PIP_CONFIG: PipConfig = {
|
||||
enabled: false,
|
||||
layers: [],
|
||||
}
|
||||
|
||||
/* ──────── 滤镜调色 ──────── */
|
||||
|
||||
/** 预设滤镜 */
|
||||
export type FilterPreset =
|
||||
| "none"
|
||||
| "original"
|
||||
| "fresh"
|
||||
| "warm"
|
||||
| "cool"
|
||||
| "vintage"
|
||||
| "cinema"
|
||||
| "bw"
|
||||
| "sunshine"
|
||||
| "film"
|
||||
|
||||
/** 预设滤镜标签 */
|
||||
export const FILTER_PRESET_LABELS: Record<FilterPreset, string> = {
|
||||
none: "无",
|
||||
original: "原片",
|
||||
fresh: "清新",
|
||||
warm: "暖调",
|
||||
cool: "冷色",
|
||||
vintage: "复古",
|
||||
cinema: "电影",
|
||||
bw: "黑白",
|
||||
sunshine: "暖阳",
|
||||
film: "胶片",
|
||||
}
|
||||
|
||||
/** 滤镜调色配置 */
|
||||
export interface FilterConfig {
|
||||
/** 是否启用滤镜 */
|
||||
enabled: boolean
|
||||
/** 预设滤镜 */
|
||||
preset: FilterPreset
|
||||
/** 亮度(-100 ~ 100) */
|
||||
brightness: number
|
||||
/** 对比度(-100 ~ 100) */
|
||||
contrast: number
|
||||
/** 饱和度(-100 ~ 100) */
|
||||
saturation: number
|
||||
/** 色温(-100 ~ 100,负值偏蓝,正值偏黄) */
|
||||
temperature: number
|
||||
/** 色调(-100 ~ 100,负值偏绿,正值偏品红) */
|
||||
tint: number
|
||||
/** 锐度(0 ~ 100) */
|
||||
sharpness: number
|
||||
}
|
||||
|
||||
/** 默认滤镜调色配置 */
|
||||
export const DEFAULT_FILTER_CONFIG: FilterConfig = {
|
||||
enabled: false,
|
||||
preset: "none",
|
||||
brightness: 0,
|
||||
contrast: 0,
|
||||
saturation: 0,
|
||||
temperature: 0,
|
||||
tint: 0,
|
||||
sharpness: 0,
|
||||
}
|
||||
|
||||
/* ──────── 绿幕抠像 ──────── */
|
||||
|
||||
/** 绿幕抠像颜色预设 */
|
||||
export type ChromaKeyColorPreset = "green" | "blue" | "red" | "pure_green" | "soft_green"
|
||||
|
||||
/** 颜色预设标签 */
|
||||
export const CHROMA_KEY_PRESET_LABELS: Record<ChromaKeyColorPreset, string> = {
|
||||
green: "绿",
|
||||
blue: "蓝",
|
||||
red: "红",
|
||||
pure_green: "精绿",
|
||||
soft_green: "柔绿",
|
||||
}
|
||||
|
||||
/** 颜色预设对应的默认色值 */
|
||||
export const CHROMA_KEY_PRESET_COLORS: Record<ChromaKeyColorPreset, string> = {
|
||||
green: "#00FF00",
|
||||
blue: "#0000FF",
|
||||
red: "#FF0000",
|
||||
pure_green: "#00C800",
|
||||
soft_green: "#40E040",
|
||||
}
|
||||
|
||||
/** 绿幕抠像配置 */
|
||||
export interface ChromaKeyConfig {
|
||||
/** 是否启用绿幕抠像 */
|
||||
enabled: boolean
|
||||
/** 颜色预设 */
|
||||
color_preset: ChromaKeyColorPreset
|
||||
/** 抠像目标颜色(HEX) */
|
||||
color: string
|
||||
/** 相似度(0 ~ 100,越大容忍的色差范围越广) */
|
||||
similarity: number
|
||||
/** 边缘平滑(0 ~ 100,越大边缘越柔和) */
|
||||
blend: number
|
||||
/** 溢色抑制(0 ~ 100,去除边缘颜色溢出) */
|
||||
spill: number
|
||||
}
|
||||
|
||||
/** 默认绿幕抠像配置 */
|
||||
export const DEFAULT_CHROMA_KEY_CONFIG: ChromaKeyConfig = {
|
||||
enabled: false,
|
||||
color_preset: "green",
|
||||
color: "#00FF00",
|
||||
similarity: 30,
|
||||
blend: 10,
|
||||
spill: 20,
|
||||
}
|
||||
|
||||
/* ──────── 贴纸配置 ──────── */
|
||||
|
||||
/** 贴纸类型 */
|
||||
export type StickerType = "emoji" | "image" | "text"
|
||||
|
||||
/** 文字花字预设 */
|
||||
export type TextStickerPreset =
|
||||
| "normal" // 普通
|
||||
| "highlight" // 高亮
|
||||
| "bubble" // 气泡
|
||||
| "neon" // 霓虹
|
||||
| "shadow" // 投影
|
||||
| "outline" // 描边
|
||||
| "gradient" // 渐变
|
||||
| "handwrite" // 手写
|
||||
|
||||
/** 贴纸项 */
|
||||
export interface StickerItem {
|
||||
id: string
|
||||
/** 贴纸类型 */
|
||||
type: StickerType
|
||||
/** 内容(emoji 字符 / 图片 URL / 文字内容) */
|
||||
content: string
|
||||
/** X 坐标(百分比 0~100) */
|
||||
x: number
|
||||
/** Y 坐标(百分比 0~100) */
|
||||
y: number
|
||||
/** 宽度(百分比 0~100) */
|
||||
width: number
|
||||
/** 高度(百分比 0~100) */
|
||||
height: number
|
||||
/** 旋转角度(度 -180~180) */
|
||||
rotation: number
|
||||
/** 不透明度(0~100) */
|
||||
opacity: number
|
||||
/** 开始时间(秒) */
|
||||
start_time: number
|
||||
/** 持续时长(秒,0 表示全程显示) */
|
||||
duration: number
|
||||
/** 图层顺序 */
|
||||
z_index: number
|
||||
/** 文字花字预设(仅 type=text 时有效) */
|
||||
text_preset: TextStickerPreset
|
||||
/** 文字颜色(仅 type=text 时有效) */
|
||||
text_color: string
|
||||
/** 文字大小(px,仅 type=text 时有效) */
|
||||
font_size: number
|
||||
}
|
||||
|
||||
/** 贴纸配置 */
|
||||
export interface StickerConfig {
|
||||
enabled: boolean
|
||||
items: StickerItem[]
|
||||
}
|
||||
|
||||
/** 默认贴纸项 */
|
||||
export const DEFAULT_STICKER_ITEM: StickerItem = {
|
||||
id: "",
|
||||
type: "emoji",
|
||||
content: "😀",
|
||||
x: 50,
|
||||
y: 50,
|
||||
width: 15,
|
||||
height: 15,
|
||||
rotation: 0,
|
||||
opacity: 100,
|
||||
start_time: 0,
|
||||
duration: 0,
|
||||
z_index: 1,
|
||||
text_preset: "normal",
|
||||
text_color: "#FFFFFF",
|
||||
font_size: 24,
|
||||
}
|
||||
|
||||
/** 默认贴纸配置 */
|
||||
export const DEFAULT_STICKER_CONFIG: StickerConfig = {
|
||||
enabled: false,
|
||||
items: [],
|
||||
}
|
||||
|
||||
/** 文字花字预设标签 */
|
||||
export const TEXT_STICKER_PRESET_LABELS: Record<TextStickerPreset, string> = {
|
||||
normal: "普通",
|
||||
highlight: "高亮",
|
||||
bubble: "气泡",
|
||||
neon: "霓虹",
|
||||
shadow: "投影",
|
||||
outline: "描边",
|
||||
gradient: "渐变",
|
||||
handwrite: "手写",
|
||||
}
|
||||
|
||||
/* ──────── 封面配置 ──────── */
|
||||
|
||||
/** 封面来源模式 */
|
||||
export type CoverMode = "auto" | "frame" | "upload"
|
||||
|
||||
/** 封面配置 */
|
||||
export interface CoverConfig {
|
||||
/** 是否启用自定义封面 */
|
||||
enabled: boolean
|
||||
/** 封面来源模式 */
|
||||
mode: CoverMode
|
||||
/** 抽帧时间点(秒,mode=frame 时使用) */
|
||||
frame_time: number
|
||||
/** 上传的封面 URL(mode=upload 时使用) */
|
||||
upload_url: string
|
||||
/** AI 智能推荐的抽帧时间(由后端分析得出) */
|
||||
ai_suggested_time: number | null
|
||||
/** 封面缩略图 URL */
|
||||
thumbnail_url: string
|
||||
}
|
||||
|
||||
/** 默认封面配置 */
|
||||
export const DEFAULT_COVER_CONFIG: CoverConfig = {
|
||||
enabled: false,
|
||||
mode: "auto",
|
||||
frame_time: 0,
|
||||
upload_url: "",
|
||||
ai_suggested_time: null,
|
||||
thumbnail_url: "",
|
||||
}
|
||||
|
||||
/* ──────── 片段数据 ──────── */
|
||||
|
||||
export interface ClipData {
|
||||
id: string
|
||||
type: ClipType // 片段类型:voice(口播)或 pip(混剪)
|
||||
duration: number // 时长(秒)
|
||||
startOffset: number // 仅 voice 类型:在口播素材中的起始时间(秒)
|
||||
/** 素材库素材 ID(main/pip 类型片段使用) */
|
||||
media_asset_id?: string
|
||||
// 保留兼容字段(后端序列化需要)
|
||||
template_segment_id?: string
|
||||
script_text?: string
|
||||
order?: number
|
||||
/** 配音素材 ID(voice 类型片段使用) */
|
||||
voice_asset_id?: string
|
||||
/** 配音素材文件 URL(voice 类型片段使用) */
|
||||
voice_file_url?: string
|
||||
/** 与前一片段之间的转场效果 */
|
||||
transition?: TransitionConfig
|
||||
/** 播放速度配置 */
|
||||
speed?: SpeedConfig
|
||||
/** TTS 配音配置 */
|
||||
tts_config?: TtsConfig
|
||||
/** 裁剪配置 — 定义素材入点/出点 */
|
||||
trim_config?: TrimConfig
|
||||
}
|
||||
|
||||
/* ──────── 标题设置 ──────── */
|
||||
|
||||
/**
|
||||
* 标题设置 — 对齐后端 title_config 字段
|
||||
* 前端 UI 使用 camelCase,发送到后端时映射为 snake_case
|
||||
*/
|
||||
export interface TitleSettings {
|
||||
aiAutoSelect: boolean
|
||||
title: string
|
||||
position: string
|
||||
font: string
|
||||
size: number
|
||||
bold: boolean
|
||||
italic: boolean
|
||||
stroke: boolean
|
||||
shadow: boolean
|
||||
color: string
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* 绿幕抠像类型
|
||||
*/
|
||||
|
||||
/** 绿幕抠像颜色预设 */
|
||||
export type ChromaKeyColorPreset = "green" | "blue" | "red" | "pure_green" | "soft_green"
|
||||
|
||||
/** 颜色预设标签 */
|
||||
export const CHROMA_KEY_PRESET_LABELS: Record<ChromaKeyColorPreset, string> = {
|
||||
green: "绿",
|
||||
blue: "蓝",
|
||||
red: "红",
|
||||
pure_green: "精绿",
|
||||
soft_green: "柔绿",
|
||||
}
|
||||
|
||||
/** 颜色预设对应的默认色值 */
|
||||
export const CHROMA_KEY_PRESET_COLORS: Record<ChromaKeyColorPreset, string> = {
|
||||
green: "#00FF00",
|
||||
blue: "#0000FF",
|
||||
red: "#FF0000",
|
||||
pure_green: "#00C800",
|
||||
soft_green: "#40E040",
|
||||
}
|
||||
|
||||
/** 绿幕抠像配置 */
|
||||
export interface ChromaKeyConfig {
|
||||
/** 是否启用绿幕抠像 */
|
||||
enabled: boolean
|
||||
/** 颜色预设 */
|
||||
color_preset: ChromaKeyColorPreset
|
||||
/** 抠像目标颜色(HEX) */
|
||||
color: string
|
||||
/** 相似度(0 ~ 100,越大容忍的色差范围越广) */
|
||||
similarity: number
|
||||
/** 边缘平滑(0 ~ 100,越大边缘越柔和) */
|
||||
blend: number
|
||||
/** 溢色抑制(0 ~ 100,去除边缘颜色溢出) */
|
||||
spill: number
|
||||
}
|
||||
|
||||
/** 默认绿幕抠像配置 */
|
||||
export const DEFAULT_CHROMA_KEY_CONFIG: ChromaKeyConfig = {
|
||||
enabled: false,
|
||||
color_preset: "green",
|
||||
color: "#00FF00",
|
||||
similarity: 30,
|
||||
blend: 10,
|
||||
spill: 20,
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* 片段数据类型
|
||||
*/
|
||||
import type { TransitionConfig } from "./transition"
|
||||
import type { SpeedConfig } from "./speed"
|
||||
import type { TtsConfig } from "./tts"
|
||||
import type { TrimConfig } from "./trim"
|
||||
|
||||
/** 片段类型 */
|
||||
export type ClipType = "voice" | "pip"
|
||||
|
||||
/** 片段数据 — 时间规划 + 类型标记,不绑定任何素材 */
|
||||
export interface ClipData {
|
||||
id: string
|
||||
type: ClipType // 片段类型:voice(口播)或 pip(混剪)
|
||||
duration: number // 时长(秒)
|
||||
startOffset: number // 仅 voice 类型:在口播素材中的起始时间(秒)
|
||||
/** 素材库素材 ID(main/pip 类型片段使用) */
|
||||
media_asset_id?: string
|
||||
// 保留兼容字段(后端序列化需要)
|
||||
template_segment_id?: string
|
||||
script_text?: string
|
||||
order?: number
|
||||
/** 配音素材 ID(voice 类型片段使用) */
|
||||
voice_asset_id?: string
|
||||
/** 配音素材文件 URL(voice 类型片段使用) */
|
||||
voice_file_url?: string
|
||||
/** 与前一片段之间的转场效果 */
|
||||
transition?: TransitionConfig
|
||||
/** 播放速度配置 */
|
||||
speed?: SpeedConfig
|
||||
/** TTS 配音配置 */
|
||||
tts_config?: TtsConfig
|
||||
/** 裁剪配置 — 定义素材入点/出点 */
|
||||
trim_config?: TrimConfig
|
||||
}
|
||||
Executable → Regular
+1
-1
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* ClipPropertiesPanel 相关类型定义
|
||||
*/
|
||||
import type { ClipData } from "@/pages/editing-planner/types"
|
||||
import type { ClipData } from "./clip"
|
||||
import type { TemplateMode } from "@/api/editing-planner"
|
||||
import type { AssetItem } from "@/api/assets"
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 封面配置类型
|
||||
*/
|
||||
|
||||
/** 封面来源模式 */
|
||||
export type CoverMode = "auto" | "frame" | "upload"
|
||||
|
||||
/** 封面配置 */
|
||||
export interface CoverConfig {
|
||||
/** 是否启用自定义封面 */
|
||||
enabled: boolean
|
||||
/** 封面来源模式 */
|
||||
mode: CoverMode
|
||||
/** 抽帧时间点(秒,mode=frame 时使用) */
|
||||
frame_time: number
|
||||
/** 上传的封面 URL(mode=upload 时使用) */
|
||||
upload_url: string
|
||||
/** AI 智能推荐的抽帧时间(由后端分析得出) */
|
||||
ai_suggested_time: number | null
|
||||
/** 封面缩略图 URL */
|
||||
thumbnail_url: string
|
||||
}
|
||||
|
||||
/** 默认封面配置 */
|
||||
export const DEFAULT_COVER_CONFIG: CoverConfig = {
|
||||
enabled: false,
|
||||
mode: "auto",
|
||||
frame_time: 0,
|
||||
upload_url: "",
|
||||
ai_suggested_time: null,
|
||||
thumbnail_url: "",
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* 滤镜调色类型
|
||||
*/
|
||||
|
||||
/** 预设滤镜 */
|
||||
export type FilterPreset =
|
||||
| "none"
|
||||
| "original"
|
||||
| "fresh"
|
||||
| "warm"
|
||||
| "cool"
|
||||
| "vintage"
|
||||
| "cinema"
|
||||
| "bw"
|
||||
| "sunshine"
|
||||
| "film"
|
||||
|
||||
/** 预设滤镜标签 */
|
||||
export const FILTER_PRESET_LABELS: Record<FilterPreset, string> = {
|
||||
none: "无",
|
||||
original: "原片",
|
||||
fresh: "清新",
|
||||
warm: "暖调",
|
||||
cool: "冷色",
|
||||
vintage: "复古",
|
||||
cinema: "电影",
|
||||
bw: "黑白",
|
||||
sunshine: "暖阳",
|
||||
film: "胶片",
|
||||
}
|
||||
|
||||
/** 滤镜调色配置 */
|
||||
export interface FilterConfig {
|
||||
/** 是否启用滤镜 */
|
||||
enabled: boolean
|
||||
/** 预设滤镜 */
|
||||
preset: FilterPreset
|
||||
/** 亮度(-100 ~ 100) */
|
||||
brightness: number
|
||||
/** 对比度(-100 ~ 100) */
|
||||
contrast: number
|
||||
/** 饱和度(-100 ~ 100) */
|
||||
saturation: number
|
||||
/** 色温(-100 ~ 100,负值偏蓝,正值偏黄) */
|
||||
temperature: number
|
||||
/** 色调(-100 ~ 100,负值偏绿,正值偏品红) */
|
||||
tint: number
|
||||
/** 锐度(0 ~ 100) */
|
||||
sharpness: number
|
||||
}
|
||||
|
||||
/** 默认滤镜调色配置 */
|
||||
export const DEFAULT_FILTER_CONFIG: FilterConfig = {
|
||||
enabled: false,
|
||||
preset: "none",
|
||||
brightness: 0,
|
||||
contrast: 0,
|
||||
saturation: 0,
|
||||
temperature: 0,
|
||||
tint: 0,
|
||||
sharpness: 0,
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* EditingPlanner 类型定义入口
|
||||
* 按功能模块拆分,统一从这里导出
|
||||
*/
|
||||
|
||||
/* 转场 */
|
||||
export {
|
||||
type TransitionType,
|
||||
type TransitionConfig,
|
||||
DEFAULT_TRANSITION,
|
||||
} from "./transition"
|
||||
|
||||
/* 调速 */
|
||||
export { type SpeedConfig, DEFAULT_SPEED } from "./speed"
|
||||
|
||||
/* TTS 配音 */
|
||||
export {
|
||||
type TtsMode,
|
||||
type TtsConfig,
|
||||
DEFAULT_TTS_CONFIG,
|
||||
} from "./tts"
|
||||
|
||||
/* 裁剪 */
|
||||
export { type TrimConfig } from "./trim"
|
||||
|
||||
/* 水印 */
|
||||
export {
|
||||
type WatermarkType,
|
||||
type WatermarkPosition,
|
||||
type ScrollDirection,
|
||||
type WatermarkConfig,
|
||||
DEFAULT_WATERMARK,
|
||||
} from "./watermark"
|
||||
|
||||
/* 片头片尾 */
|
||||
export {
|
||||
type IntroOutroKind,
|
||||
type IntroOutroItem,
|
||||
type IntroOutroConfig,
|
||||
DEFAULT_INTRO_OUTRO,
|
||||
} from "./intro-outro"
|
||||
|
||||
/* 混剪 PiP */
|
||||
export {
|
||||
type PipGridPosition,
|
||||
type PipAnimType,
|
||||
type PipSlideDirection,
|
||||
type PipLayer,
|
||||
type PipConfig,
|
||||
DEFAULT_PIP_LAYER,
|
||||
DEFAULT_PIP_CONFIG,
|
||||
} from "./pip"
|
||||
|
||||
/* 滤镜调色 */
|
||||
export {
|
||||
type FilterPreset,
|
||||
FILTER_PRESET_LABELS,
|
||||
type FilterConfig,
|
||||
DEFAULT_FILTER_CONFIG,
|
||||
} from "./filter"
|
||||
|
||||
/* 绿幕抠像 */
|
||||
export {
|
||||
type ChromaKeyColorPreset,
|
||||
CHROMA_KEY_PRESET_LABELS,
|
||||
CHROMA_KEY_PRESET_COLORS,
|
||||
type ChromaKeyConfig,
|
||||
DEFAULT_CHROMA_KEY_CONFIG,
|
||||
} from "./chroma-key"
|
||||
|
||||
/* 贴纸 */
|
||||
export {
|
||||
type StickerType,
|
||||
type TextStickerPreset,
|
||||
type StickerItem,
|
||||
type StickerConfig,
|
||||
DEFAULT_STICKER_ITEM,
|
||||
DEFAULT_STICKER_CONFIG,
|
||||
TEXT_STICKER_PRESET_LABELS,
|
||||
} from "./sticker"
|
||||
|
||||
/* 封面 */
|
||||
export {
|
||||
type CoverMode,
|
||||
type CoverConfig,
|
||||
DEFAULT_COVER_CONFIG,
|
||||
} from "./cover"
|
||||
|
||||
/* 片段数据 */
|
||||
export { type ClipType, type ClipData } from "./clip"
|
||||
|
||||
/* 标题设置 */
|
||||
export { type TitleSettings } from "./title"
|
||||
|
||||
/* 字幕样式 */
|
||||
export {
|
||||
type SubtitleStyleConfig,
|
||||
DEFAULT_SUBTITLE_STYLE,
|
||||
} from "./subtitle"
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 片头片尾配置类型
|
||||
*/
|
||||
import type { TransitionType } from "./transition"
|
||||
|
||||
/** 片头片尾素材类型 */
|
||||
export type IntroOutroKind = "none" | "video" | "image"
|
||||
|
||||
/** 片头/片尾单项配置 */
|
||||
export interface IntroOutroItem {
|
||||
/** 素材类型 */
|
||||
kind: IntroOutroKind
|
||||
/** 素材 URL */
|
||||
url?: string
|
||||
/** 显示时长(秒) */
|
||||
duration: number
|
||||
/** 过渡动画 */
|
||||
transition?: TransitionType
|
||||
/** 过渡时长(秒) */
|
||||
transition_duration?: number
|
||||
}
|
||||
|
||||
/** 片头片尾完整配置 */
|
||||
export interface IntroOutroConfig {
|
||||
intro: IntroOutroItem
|
||||
outro: IntroOutroItem
|
||||
}
|
||||
|
||||
/** 默认片头片尾配置 */
|
||||
export const DEFAULT_INTRO_OUTRO: IntroOutroConfig = {
|
||||
intro: { kind: "none", duration: 3 },
|
||||
outro: { kind: "none", duration: 3 },
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* 混剪(PiP)配置类型
|
||||
*/
|
||||
|
||||
/** 九宫格位置 */
|
||||
export type PipGridPosition =
|
||||
| "top_left"
|
||||
| "top_center"
|
||||
| "top_right"
|
||||
| "center_left"
|
||||
| "center"
|
||||
| "center_right"
|
||||
| "bottom_left"
|
||||
| "bottom_center"
|
||||
| "bottom_right"
|
||||
|
||||
/** 入场动画类型 */
|
||||
export type PipAnimType = "none" | "fade_in" | "slide_in"
|
||||
|
||||
/** 入场方向 */
|
||||
export type PipSlideDirection = "left" | "right" | "up" | "down"
|
||||
|
||||
/** 混剪图层 */
|
||||
export interface PipLayer {
|
||||
id: string
|
||||
/** 图层名称(用户可编辑) */
|
||||
name: string
|
||||
/** 素材类型 */
|
||||
material_type: "image" | "video"
|
||||
/** 素材 URL */
|
||||
material_url: string
|
||||
/** 素材缩略图 */
|
||||
thumbnail_url?: string
|
||||
/** 九宫格快捷位置 */
|
||||
grid_position: PipGridPosition
|
||||
/** 精确 X 坐标(百分比 0~100) */
|
||||
x: number
|
||||
/** 精确 Y 坐标(百分比 0~100) */
|
||||
y: number
|
||||
/** 宽度(百分比 0~100,相对主画面) */
|
||||
width: number
|
||||
/** 高度(百分比 0~100,相对主画面) */
|
||||
height: number
|
||||
/** 锁定宽高比 */
|
||||
aspect_lock: boolean
|
||||
/** 圆角(百分比 0~50) */
|
||||
border_radius: number
|
||||
/** 不透明度(0~100) */
|
||||
opacity: number
|
||||
/** 开始时间(秒) */
|
||||
start_time: number
|
||||
/** 持续时长(秒) */
|
||||
duration: number
|
||||
/** 入场动画 */
|
||||
animation: PipAnimType
|
||||
/** 入场方向 */
|
||||
slide_direction: PipSlideDirection
|
||||
/** 图层顺序(z-index) */
|
||||
z_index: number
|
||||
}
|
||||
|
||||
/** 混剪配置 */
|
||||
export interface PipConfig {
|
||||
/** 是否启用混剪 */
|
||||
enabled: boolean
|
||||
/** 图层列表 */
|
||||
layers: PipLayer[]
|
||||
}
|
||||
|
||||
/** 默认 PiP 图层 */
|
||||
export const DEFAULT_PIP_LAYER: PipLayer = {
|
||||
id: "",
|
||||
name: "图层",
|
||||
material_type: "image",
|
||||
material_url: "",
|
||||
grid_position: "top_right",
|
||||
x: 70,
|
||||
y: 5,
|
||||
width: 25,
|
||||
height: 25,
|
||||
aspect_lock: true,
|
||||
border_radius: 0,
|
||||
opacity: 100,
|
||||
start_time: 0,
|
||||
duration: 5,
|
||||
animation: "none",
|
||||
slide_direction: "right",
|
||||
z_index: 1,
|
||||
}
|
||||
|
||||
/** 默认 PiP 配置 */
|
||||
export const DEFAULT_PIP_CONFIG: PipConfig = {
|
||||
enabled: false,
|
||||
layers: [],
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 片段调速类型
|
||||
*/
|
||||
|
||||
/** 片段调速配置 */
|
||||
export interface SpeedConfig {
|
||||
/** 播放速度,0.25 ~ 4.0 */
|
||||
rate: number
|
||||
/** 音调修正(变速不变调) */
|
||||
pitchCorrection: boolean
|
||||
}
|
||||
|
||||
/** 默认调速配置 */
|
||||
export const DEFAULT_SPEED: SpeedConfig = {
|
||||
rate: 1.0,
|
||||
pitchCorrection: true,
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* 贴纸配置类型
|
||||
*/
|
||||
|
||||
/** 贴纸类型 */
|
||||
export type StickerType = "emoji" | "image" | "text"
|
||||
|
||||
/** 文字花字预设 */
|
||||
export type TextStickerPreset =
|
||||
| "normal" // 普通
|
||||
| "highlight" // 高亮
|
||||
| "bubble" // 气泡
|
||||
| "neon" // 霓虹
|
||||
| "shadow" // 投影
|
||||
| "outline" // 描边
|
||||
| "gradient" // 渐变
|
||||
| "handwrite" // 手写
|
||||
|
||||
/** 贴纸项 */
|
||||
export interface StickerItem {
|
||||
id: string
|
||||
/** 贴纸类型 */
|
||||
type: StickerType
|
||||
/** 内容(emoji 字符 / 图片 URL / 文字内容) */
|
||||
content: string
|
||||
/** X 坐标(百分比 0~100) */
|
||||
x: number
|
||||
/** Y 坐标(百分比 0~100) */
|
||||
y: number
|
||||
/** 宽度(百分比 0~100) */
|
||||
width: number
|
||||
/** 高度(百分比 0~100) */
|
||||
height: number
|
||||
/** 旋转角度(度 -180~180) */
|
||||
rotation: number
|
||||
/** 不透明度(0~100) */
|
||||
opacity: number
|
||||
/** 开始时间(秒) */
|
||||
start_time: number
|
||||
/** 持续时长(秒,0 表示全程显示) */
|
||||
duration: number
|
||||
/** 图层顺序 */
|
||||
z_index: number
|
||||
/** 文字花字预设(仅 type=text 时有效) */
|
||||
text_preset: TextStickerPreset
|
||||
/** 文字颜色(仅 type=text 时有效) */
|
||||
text_color: string
|
||||
/** 文字大小(px,仅 type=text 时有效) */
|
||||
font_size: number
|
||||
}
|
||||
|
||||
/** 贴纸配置 */
|
||||
export interface StickerConfig {
|
||||
enabled: boolean
|
||||
items: StickerItem[]
|
||||
}
|
||||
|
||||
/** 默认贴纸项 */
|
||||
export const DEFAULT_STICKER_ITEM: StickerItem = {
|
||||
id: "",
|
||||
type: "emoji",
|
||||
content: "😀",
|
||||
x: 50,
|
||||
y: 50,
|
||||
width: 15,
|
||||
height: 15,
|
||||
rotation: 0,
|
||||
opacity: 100,
|
||||
start_time: 0,
|
||||
duration: 0,
|
||||
z_index: 1,
|
||||
text_preset: "normal",
|
||||
text_color: "#FFFFFF",
|
||||
font_size: 24,
|
||||
}
|
||||
|
||||
/** 默认贴纸配置 */
|
||||
export const DEFAULT_STICKER_CONFIG: StickerConfig = {
|
||||
enabled: false,
|
||||
items: [],
|
||||
}
|
||||
|
||||
/** 文字花字预设标签 */
|
||||
export const TEXT_STICKER_PRESET_LABELS: Record<TextStickerPreset, string> = {
|
||||
normal: "普通",
|
||||
highlight: "高亮",
|
||||
bubble: "气泡",
|
||||
neon: "霓虹",
|
||||
shadow: "投影",
|
||||
outline: "描边",
|
||||
gradient: "渐变",
|
||||
handwrite: "手写",
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* 标题设置类型
|
||||
*/
|
||||
|
||||
/**
|
||||
* 标题设置 — 对齐后端 title_config 字段
|
||||
* 前端 UI 使用 camelCase,发送到后端时映射为 snake_case
|
||||
*/
|
||||
export interface TitleSettings {
|
||||
aiAutoSelect: boolean
|
||||
title: string
|
||||
position: string
|
||||
font: string
|
||||
size: number
|
||||
bold: boolean
|
||||
italic: boolean
|
||||
stroke: boolean
|
||||
shadow: boolean
|
||||
color: string
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 转场特效类型
|
||||
*/
|
||||
|
||||
/** 14 种转场类型 */
|
||||
export type TransitionType =
|
||||
| "none"
|
||||
| "cut"
|
||||
| "fade"
|
||||
| "dissolve"
|
||||
| "zoom"
|
||||
| "slide_left"
|
||||
| "slide_right"
|
||||
| "slide_up"
|
||||
| "slide_down"
|
||||
| "wipe_left"
|
||||
| "wipe_right"
|
||||
| "wipe_up"
|
||||
| "wipe_down"
|
||||
| "circlecrop"
|
||||
| "rectcrop"
|
||||
|
||||
/** 片段间转场配置 */
|
||||
export interface TransitionConfig {
|
||||
/** 转场类型 */
|
||||
type: TransitionType
|
||||
/** 转场时长(秒),0.3 ~ 2.0 */
|
||||
duration: number
|
||||
}
|
||||
|
||||
/** 默认转场配置 */
|
||||
export const DEFAULT_TRANSITION: TransitionConfig = {
|
||||
type: "none",
|
||||
duration: 0.5,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* 片段裁剪类型
|
||||
*/
|
||||
|
||||
/** 片段裁剪配置 — 定义素材的入点/出点 */
|
||||
export interface TrimConfig {
|
||||
/** 入点(秒),素材原始时间轴上的起始位置 */
|
||||
start_time: number
|
||||
/** 出点(秒),素材原始时间轴上的结束位置 */
|
||||
end_time: number
|
||||
/** 素材原始总时长(秒),用于"恢复原始长度" */
|
||||
original_duration?: number
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* TTS 配音类型
|
||||
*/
|
||||
|
||||
/** 配音模式 */
|
||||
export type TtsMode = "none" | "upload" | "tts"
|
||||
|
||||
/** TTS 配音配置 */
|
||||
export interface TtsConfig {
|
||||
/** 配音模式 */
|
||||
mode: TtsMode
|
||||
/** TTS 合成文本 */
|
||||
text: string
|
||||
/** 音色 ID */
|
||||
voice_id: string
|
||||
/** 语速 0.5 ~ 2.0 */
|
||||
speed: number
|
||||
/** 语调(半音)-12 ~ +12 */
|
||||
pitch: number
|
||||
/** 音量 0 ~ 100 */
|
||||
volume: number
|
||||
/** 字幕联动 */
|
||||
subtitle_sync: boolean
|
||||
}
|
||||
|
||||
/** 默认 TTS 配置 */
|
||||
export const DEFAULT_TTS_CONFIG: TtsConfig = {
|
||||
mode: "none",
|
||||
text: "",
|
||||
voice_id: "",
|
||||
speed: 1.0,
|
||||
pitch: 0,
|
||||
volume: 100,
|
||||
subtitle_sync: true,
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 水印配置类型
|
||||
*/
|
||||
|
||||
/** 水印类型 */
|
||||
export type WatermarkType = "none" | "image" | "text" | "scroll"
|
||||
|
||||
/** 水印位置 */
|
||||
export type WatermarkPosition = "top_left" | "top_right" | "bottom_left" | "bottom_right" | "center"
|
||||
|
||||
/** 滚动水印方向 */
|
||||
export type ScrollDirection = "horizontal" | "vertical" | "diagonal"
|
||||
|
||||
/** 水印配置 */
|
||||
export interface WatermarkConfig {
|
||||
/** 水印类型 */
|
||||
type: WatermarkType
|
||||
/** 图片水印 URL */
|
||||
image_url?: string
|
||||
/** 水印宽度(像素或百分比 0~1) */
|
||||
width?: number
|
||||
/** 水印高度(像素或百分比 0~1) */
|
||||
height?: number
|
||||
/** 水印位置 */
|
||||
position: WatermarkPosition
|
||||
/** 水印不透明度 0~1 */
|
||||
opacity: number
|
||||
/** 文字水印内容 */
|
||||
text?: string
|
||||
/** 文字水印字号 */
|
||||
font_size?: number
|
||||
/** 文字水印颜色 */
|
||||
color?: string
|
||||
/** 滚动水印方向 */
|
||||
scroll_direction?: ScrollDirection
|
||||
/** 滚动水印速度(像素/秒) */
|
||||
scroll_speed?: number
|
||||
}
|
||||
|
||||
/** 默认水印配置 */
|
||||
export const DEFAULT_WATERMARK: WatermarkConfig = {
|
||||
type: "none",
|
||||
position: "bottom_right",
|
||||
opacity: 0.7,
|
||||
}
|
||||
Reference in New Issue
Block a user