@volcengine/amk-editor 0.0.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +11 -0
- package/README.md +139 -0
- package/dist/amk-editor.d.ts +182 -0
- package/dist/api/client.d.ts +30 -0
- package/dist/api/preset-library.d.ts +11 -0
- package/dist/api/project.d.ts +30 -0
- package/dist/asr-progress-modal-view.d.ts +8 -0
- package/dist/asr-progress-modal.d.ts +11 -0
- package/dist/asr-text-layout.d.ts +4 -0
- package/dist/assets/export-modal-ai.png +0 -0
- package/dist/assets/export-modal-close.png +0 -0
- package/dist/assets/export-modal-info.png +0 -0
- package/dist/assets/export-modal-question.png +0 -0
- package/dist/assets/export-modal-select.png +0 -0
- package/dist/assets/header-back.png +0 -0
- package/dist/assets/header-close.png +0 -0
- package/dist/assets/header-edit.png +0 -0
- package/dist/assets/header-export.png +0 -0
- package/dist/assets/import-local.svg +3 -0
- package/dist/assets/import-url.svg +10 -0
- package/dist/confirm-modal-view.d.ts +15 -0
- package/dist/confirm-modal.d.ts +14 -0
- package/dist/export-modal-view.d.ts +11 -0
- package/dist/export-modal.d.ts +46 -0
- package/dist/export-project-adapter.d.ts +14 -0
- package/dist/header.d.ts +29 -0
- package/dist/i18n/index.d.ts +17 -0
- package/dist/i18n/keys.d.ts +83 -0
- package/dist/i18n/locales/en-US.d.ts +2 -0
- package/dist/i18n/locales/zh-CN.d.ts +2 -0
- package/dist/import-actions.d.ts +14 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +128072 -0
- package/dist/local-upload-modal-view.d.ts +12 -0
- package/dist/local-upload-modal.d.ts +13 -0
- package/dist/project-bootstrap.d.ts +11 -0
- package/dist/public-types.d.ts +120 -0
- package/dist/react-mount.d.ts +10 -0
- package/dist/refresh-play-info.d.ts +17 -0
- package/dist/runtime/veveditor.d.ts +6 -0
- package/dist/task-polling.d.ts +9 -0
- package/dist/toast.d.ts +24 -0
- package/dist/types.d.ts +138 -0
- package/dist/url-upload-modal-view.d.ts +12 -0
- package/dist/url-upload-modal.d.ts +12 -0
- package/dist/utils/material-extract.d.ts +43 -0
- package/dist/veveditor.css +2563 -0
- package/package.json +52 -0
- package/third_party_notice.txt +1182 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AmkI18nInstance } from './i18n';
|
|
3
|
+
export interface LocalUploadModalViewProps {
|
|
4
|
+
visible: boolean;
|
|
5
|
+
initialFiles: File[];
|
|
6
|
+
accept?: string;
|
|
7
|
+
t: AmkI18nInstance['t'];
|
|
8
|
+
/** 确认后弹窗立即关闭;上传过程由外部 Message 提示 */
|
|
9
|
+
onConfirm: (files: File[]) => void;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function LocalUploadModalView({ visible, initialFiles, accept, t, onConfirm, onClose, }: LocalUploadModalViewProps): React.ReactElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AmkI18nInstance } from './i18n';
|
|
2
|
+
export interface CreateLocalUploadModalOptions {
|
|
3
|
+
container: HTMLElement;
|
|
4
|
+
accept?: string;
|
|
5
|
+
t: AmkI18nInstance['t'];
|
|
6
|
+
onConfirm: (files: File[]) => void;
|
|
7
|
+
}
|
|
8
|
+
export interface LocalUploadModalController {
|
|
9
|
+
open: (files: File[]) => void;
|
|
10
|
+
close: () => void;
|
|
11
|
+
destroy: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function createLocalUploadModal(options: CreateLocalUploadModalOptions): LocalUploadModalController;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AmkProjectSnapshot, MaterialItem } from './types';
|
|
2
|
+
/** 预览与导出统一使用 NativeRender 的多语言断行规则。 */
|
|
3
|
+
export declare function addForceMultilingualLineBreak(editParam: Record<string, unknown>): Record<string, unknown>;
|
|
4
|
+
export declare function normalizeLoadedProject(input: AmkProjectSnapshot | undefined): Required<Pick<AmkProjectSnapshot, 'materials' | 'editParam'>> & {
|
|
5
|
+
projectName?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function toEditorInitialData(params: {
|
|
8
|
+
projectName?: string;
|
|
9
|
+
materials: MaterialItem[];
|
|
10
|
+
editParam: Record<string, unknown>;
|
|
11
|
+
}): AmkProjectSnapshot;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 公网包的自包含类型契约。
|
|
3
|
+
*
|
|
4
|
+
* 这些类型与底层编辑器的公开 Options 保持结构兼容,但不引用底层内部包,
|
|
5
|
+
* 避免公网用户安装 amk-editor 时还需要访问内网依赖。
|
|
6
|
+
*/
|
|
7
|
+
export type VeVeditorTheme = 'light' | 'dark';
|
|
8
|
+
export interface VeVeditorMaterialItem {
|
|
9
|
+
id?: string;
|
|
10
|
+
type?: 'video' | 'audio' | 'image' | string;
|
|
11
|
+
source: string;
|
|
12
|
+
material_id?: string;
|
|
13
|
+
source_material_id?: string;
|
|
14
|
+
url?: string;
|
|
15
|
+
poster?: string;
|
|
16
|
+
sprite?: string | Record<string, unknown>;
|
|
17
|
+
waveform?: string | Record<string, unknown>;
|
|
18
|
+
duration?: number;
|
|
19
|
+
width?: number;
|
|
20
|
+
height?: number;
|
|
21
|
+
kid?: string;
|
|
22
|
+
bizMeta?: Record<string, unknown>;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
export interface VeVeditorI18nOptions {
|
|
26
|
+
locale?: string;
|
|
27
|
+
messages?: Record<string, Record<string, string>>;
|
|
28
|
+
messageOverrides?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
export interface VeVeditorDecodeOptions {
|
|
31
|
+
enableAudioFrontendDecode?: boolean;
|
|
32
|
+
enableVideoFrontendDecode?: boolean;
|
|
33
|
+
decodeConcurrency?: number;
|
|
34
|
+
decodeTopK?: number;
|
|
35
|
+
enableThumbnailDecode?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export type VeVeditorResourceOptionTypes = {
|
|
38
|
+
font: unknown;
|
|
39
|
+
wordArt: unknown;
|
|
40
|
+
textAnimation: unknown;
|
|
41
|
+
transition: unknown;
|
|
42
|
+
filter: unknown;
|
|
43
|
+
effect: unknown;
|
|
44
|
+
};
|
|
45
|
+
export type VeVeditorResourceSource<T = unknown> = T[] | {
|
|
46
|
+
resources: T[];
|
|
47
|
+
categories?: Array<Record<string, unknown>>;
|
|
48
|
+
} | (() => Promise<T[] | {
|
|
49
|
+
resources: T[];
|
|
50
|
+
categories?: Array<Record<string, unknown>>;
|
|
51
|
+
}>) | false;
|
|
52
|
+
export interface VeVeditorMaterialOptions<TMaterialItem = VeVeditorMaterialItem> {
|
|
53
|
+
show?: boolean;
|
|
54
|
+
emptyIcon?: string;
|
|
55
|
+
showClassification?: boolean;
|
|
56
|
+
defaultClassificationId?: string | null;
|
|
57
|
+
showExportVideoClassification?: boolean;
|
|
58
|
+
sketchItems?: TMaterialItem[];
|
|
59
|
+
sketchShowAdd?: boolean;
|
|
60
|
+
sketchShowDelete?: boolean;
|
|
61
|
+
showProductCategory?: boolean;
|
|
62
|
+
renderChannels?: () => unknown;
|
|
63
|
+
renderImportActions?: (container: HTMLElement) => void | (() => void);
|
|
64
|
+
onDeleteMaterial?: (material: TMaterialItem) => boolean | void | Promise<boolean | void>;
|
|
65
|
+
}
|
|
66
|
+
export interface VeVeditorOptions<TMaterialOptions = VeVeditorMaterialOptions, TI18nOptions = VeVeditorI18nOptions, TResourceOptions extends VeVeditorResourceOptionTypes = VeVeditorResourceOptionTypes> {
|
|
67
|
+
container: HTMLElement;
|
|
68
|
+
theme?: VeVeditorTheme;
|
|
69
|
+
material?: TMaterialOptions;
|
|
70
|
+
i18n?: TI18nOptions;
|
|
71
|
+
decode?: VeVeditorDecodeOptions;
|
|
72
|
+
track?: Record<string, unknown>;
|
|
73
|
+
toolbar?: Record<string, unknown>;
|
|
74
|
+
navigationBar?: Record<string, unknown>;
|
|
75
|
+
videoOperationBar?: Record<string, unknown>;
|
|
76
|
+
layout?: Record<string, unknown>;
|
|
77
|
+
ui?: Record<string, unknown>;
|
|
78
|
+
shortcut?: Record<string, boolean | undefined>;
|
|
79
|
+
interaction?: {
|
|
80
|
+
readonly?: boolean;
|
|
81
|
+
};
|
|
82
|
+
frameRate?: {
|
|
83
|
+
type?: 'source' | 'target';
|
|
84
|
+
frameRate?: number;
|
|
85
|
+
};
|
|
86
|
+
timeDisplayFormat?: 'hms' | 'msms' | 'msf';
|
|
87
|
+
crashedFallback?: string;
|
|
88
|
+
debug?: boolean;
|
|
89
|
+
renderMode?: 'webgl' | 'native';
|
|
90
|
+
initialData?: Record<string, unknown>;
|
|
91
|
+
font?: TResourceOptions['font'];
|
|
92
|
+
wordArt?: TResourceOptions['wordArt'];
|
|
93
|
+
textAnimation?: TResourceOptions['textAnimation'];
|
|
94
|
+
transition?: TResourceOptions['transition'];
|
|
95
|
+
filter?: TResourceOptions['filter'];
|
|
96
|
+
effect?: TResourceOptions['effect'];
|
|
97
|
+
recording?: Record<string, unknown>;
|
|
98
|
+
onSketchItemsChange?: (params: {
|
|
99
|
+
sketchItems?: VeVeditorMaterialItem[];
|
|
100
|
+
action?: 'delete' | 'add';
|
|
101
|
+
item?: unknown;
|
|
102
|
+
}) => void;
|
|
103
|
+
onNodePreviewError?: (type: 'video' | 'audio', node: unknown) => void;
|
|
104
|
+
onBeforeUndo?: (payload: unknown) => boolean | void;
|
|
105
|
+
onBeforeRedo?: (payload: unknown) => boolean | void;
|
|
106
|
+
onBeforeTimestampMount?: (params: Record<string, unknown>) => boolean | Promise<boolean>;
|
|
107
|
+
onBeforeKeyframeMount?: (params: Record<string, unknown>) => boolean | Promise<boolean>;
|
|
108
|
+
onTrackChanged?: (payload: unknown) => unknown;
|
|
109
|
+
onRecordingUpload?: (params: Record<string, unknown>) => Promise<boolean | {
|
|
110
|
+
success: boolean;
|
|
111
|
+
url?: string;
|
|
112
|
+
name?: string;
|
|
113
|
+
userDataPatch?: Record<string, unknown>;
|
|
114
|
+
}> | boolean | {
|
|
115
|
+
success: boolean;
|
|
116
|
+
url?: string;
|
|
117
|
+
name?: string;
|
|
118
|
+
userDataPatch?: Record<string, unknown>;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* React 18/19 挂载封装:createRoot + render / unmount。
|
|
4
|
+
* 避免 ReactDOM.render / unmountComponentAtNode(React 18 弃用,19 已移除)。
|
|
5
|
+
* 命令式 modal 宿主需要同步刷 DOM,故 render 包一层 flushSync。
|
|
6
|
+
*/
|
|
7
|
+
export declare function createReactMount(container: HTMLElement): {
|
|
8
|
+
render: (element: ReactElement) => void;
|
|
9
|
+
unmount: () => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MaterialItem } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 业务方回写的播放信息补丁;未返回的字段保持原样。
|
|
4
|
+
* 按 SDK 内部 material_id 匹配目标素材;可更新 url / poster / sprite / source_material_id 等。
|
|
5
|
+
* material_id 为 SDK 内部字段,补丁中的同名字段会被忽略。
|
|
6
|
+
*/
|
|
7
|
+
export type MaterialPlayInfoPatch = Partial<MaterialItem> & {
|
|
8
|
+
material_id?: string;
|
|
9
|
+
source_material_id?: string;
|
|
10
|
+
};
|
|
11
|
+
/** SDK 内部素材关联键:material_id(不暴露给业务改写) */
|
|
12
|
+
export declare function resolveMaterialId(material: Pick<MaterialItem, 'material_id'> | MaterialPlayInfoPatch): string;
|
|
13
|
+
/** 业务侧 / Editing API 主键:source_material_id */
|
|
14
|
+
export declare function resolveSourceMaterialId(material: MaterialItem | MaterialPlayInfoPatch | Record<string, unknown>): string;
|
|
15
|
+
export declare function mergePlayInfoOverrides(materials: MaterialItem[], overrides: MaterialPlayInfoPatch | MaterialPlayInfoPatch[]): MaterialItem[];
|
|
16
|
+
/** 从当前素材库按 material_id 选出待刷新列表;未传则全量有 material_id 的素材。 */
|
|
17
|
+
export declare function pickMaterialsForRefresh(materials: MaterialItem[], materialIdOrIds?: string | string[]): MaterialItem[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function getTaskPollDelayMs(attempt: number): number;
|
|
2
|
+
export type TaskPollingController = {
|
|
3
|
+
cancel: () => void;
|
|
4
|
+
};
|
|
5
|
+
export declare function startTaskPolling(options: {
|
|
6
|
+
poll: () => Promise<boolean>;
|
|
7
|
+
onError?: (error: unknown) => void;
|
|
8
|
+
getDelayMs?: (attempt: number) => number;
|
|
9
|
+
}): TaskPollingController;
|
package/dist/toast.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type AmkMessageType = 'info' | 'warning' | 'error' | 'success' | 'loading';
|
|
2
|
+
export interface ShowAmkMessageOptions {
|
|
3
|
+
durationMs?: number;
|
|
4
|
+
type?: AmkMessageType;
|
|
5
|
+
}
|
|
6
|
+
type MessageCloser = () => void;
|
|
7
|
+
/**
|
|
8
|
+
* 轻量 Message(对齐常见 Message 用法):上传中 / 成功 / 失败提示。
|
|
9
|
+
* 不依赖外部 UI 库,避免把 Arco Message 整包打进 AMK。
|
|
10
|
+
*/
|
|
11
|
+
export declare const Message: {
|
|
12
|
+
loading(content: string): MessageCloser;
|
|
13
|
+
success(content: string): MessageCloser;
|
|
14
|
+
error(content: string): MessageCloser;
|
|
15
|
+
warning(content: string): MessageCloser;
|
|
16
|
+
info(content: string): MessageCloser;
|
|
17
|
+
clear(): void;
|
|
18
|
+
};
|
|
19
|
+
/** @deprecated 使用 Message.* */
|
|
20
|
+
export declare function showAmkToast(message: string, options?: {
|
|
21
|
+
type?: Exclude<AmkMessageType, 'loading'>;
|
|
22
|
+
durationMs?: number;
|
|
23
|
+
}): void;
|
|
24
|
+
export {};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { VeVeditorI18nOptions, VeVeditorMaterialItem, VeVeditorOptions, VeVeditorTheme, VeVeditorDecodeOptions } from './public-types';
|
|
2
|
+
export type Theme = VeVeditorTheme;
|
|
3
|
+
export interface MaterialItem extends VeVeditorMaterialItem {
|
|
4
|
+
/** 业务侧素材主键;上传 / 更新 / 删除必填。 */
|
|
5
|
+
source_material_id: string;
|
|
6
|
+
/** Editing API 生成的服务端 id;业务方不必传,传了也不会入库。 */
|
|
7
|
+
material_id?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 抽帧产物存储 key 的推荐命名,仅用于提供接入提示,不属于强制素材 Schema。
|
|
11
|
+
* 业务可以直接使用这两个字段,也可以把 key 放进任意自定义字段或嵌套对象。
|
|
12
|
+
*/
|
|
13
|
+
export interface RecommendedExtractStorageFields {
|
|
14
|
+
/** 推荐字段:封面图业务存储 key;业务也可以使用自定义字段。 */
|
|
15
|
+
poster_storage_key?: string;
|
|
16
|
+
/** 推荐字段:与 sprite.storeurls 对应的业务存储 key;也可自定义。 */
|
|
17
|
+
sprite_storage_keys?: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface PersistExtractUrlsResult {
|
|
20
|
+
/** 转存后的长期可访问 URL,须与回调入参 urls 等长。 */
|
|
21
|
+
urls: string[];
|
|
22
|
+
/**
|
|
23
|
+
* 随转存结果写回素材的业务字段,SDK 原样合并并持久化。
|
|
24
|
+
* 字段名和结构完全由业务决定;SDK 不读取推荐字段,也不限制自定义嵌套结构。
|
|
25
|
+
*/
|
|
26
|
+
materialPatch?: Partial<MaterialItem>;
|
|
27
|
+
}
|
|
28
|
+
export interface MaterialConfig {
|
|
29
|
+
emptyIcon?: string;
|
|
30
|
+
uploadAccept?: string;
|
|
31
|
+
onUploadMaterial?: (files: File[]) => Promise<MaterialItem[]> | MaterialItem[];
|
|
32
|
+
onUploadUrlMaterial?: (urls: string[]) => Promise<MaterialItem[]> | MaterialItem[];
|
|
33
|
+
onUploadFromSystem?: () => Promise<MaterialItem[]> | MaterialItem[];
|
|
34
|
+
/**
|
|
35
|
+
* 刷新播放信息。未配置时用素材库已有字段;
|
|
36
|
+
* 配置后:入参为待刷新素材列表(按服务端 material_id 区分,支持批量),
|
|
37
|
+
* 返回单条或数组补丁覆盖原素材的播放字段(url / poster / sprite / source_material_id 等)。
|
|
38
|
+
* 补丁不得改写 material_id(服务端字段,业务传了也不入库)。
|
|
39
|
+
*/
|
|
40
|
+
onRefreshPlayInfo?: (materials: MaterialItem[]) => Partial<MaterialItem> | Partial<MaterialItem>[] | Promise<Partial<MaterialItem> | Partial<MaterialItem>[]>;
|
|
41
|
+
/**
|
|
42
|
+
* 抽帧得到的临时 http(约 24h)转存成长效地址。
|
|
43
|
+
* SDK 会先用临时链上屏/落盘,再后台调用本回调换链;失败则保留临时链。
|
|
44
|
+
* 未配置则只落盘临时链;若带 auth_key 且过期,SDK 会自动重抽。
|
|
45
|
+
* 推荐返回 urls + materialPatch,把刷新 URL 所需的 storage key 或其他业务字段写入素材。
|
|
46
|
+
* SDK 不限定 materialPatch 的字段名;poster_storage_key / sprite_storage_keys 仅为推荐命名。
|
|
47
|
+
* 兼容只返回 string[],但该形式无法附带业务字段。
|
|
48
|
+
*/
|
|
49
|
+
onPersistExtractUrls?: (params: {
|
|
50
|
+
kind: 'poster' | 'sprite';
|
|
51
|
+
urls: string[];
|
|
52
|
+
material: MaterialItem;
|
|
53
|
+
}) => Promise<PersistExtractUrlsResult | string[]> | PersistExtractUrlsResult | string[];
|
|
54
|
+
}
|
|
55
|
+
export interface AmkEditorHeaderConfig {
|
|
56
|
+
show?: boolean;
|
|
57
|
+
onBack?: () => void;
|
|
58
|
+
onClose?: () => void;
|
|
59
|
+
}
|
|
60
|
+
export interface ExportVideoParams {
|
|
61
|
+
videoName: string;
|
|
62
|
+
qualityEnhancement: boolean;
|
|
63
|
+
enhancementVersion: 'standard' | 'professional' | 'large-model';
|
|
64
|
+
resolution: 'original' | '720p' | '1080p' | '2k' | '4k';
|
|
65
|
+
frameRate: number;
|
|
66
|
+
format: 'mp4' | 'mp3';
|
|
67
|
+
codec: 'h264' | 'h265' | 'vp9' | 'mp3';
|
|
68
|
+
}
|
|
69
|
+
export interface VeVeditorInstance {
|
|
70
|
+
destroy: () => void;
|
|
71
|
+
on?: (eventName: string, handler: (...args: any[]) => void) => void;
|
|
72
|
+
off?: (eventName: string, handler: (...args: any[]) => void) => void;
|
|
73
|
+
getTrack?: () => any[];
|
|
74
|
+
setTrack?: (track: any[]) => Promise<void>;
|
|
75
|
+
setTrackElementMarker?: (elementId: string, marker: {
|
|
76
|
+
key?: string;
|
|
77
|
+
content: string;
|
|
78
|
+
position?: number;
|
|
79
|
+
loading?: boolean;
|
|
80
|
+
} | null, options?: {
|
|
81
|
+
clearKey?: string;
|
|
82
|
+
}) => void;
|
|
83
|
+
getTrackElementMarkers?: (elementId: string) => Array<{
|
|
84
|
+
key?: string;
|
|
85
|
+
content: string;
|
|
86
|
+
position?: number;
|
|
87
|
+
loading?: boolean;
|
|
88
|
+
}>;
|
|
89
|
+
setTrackElementBadge?: (elementId: string, badge: {
|
|
90
|
+
type: 'spinner';
|
|
91
|
+
content?: string;
|
|
92
|
+
position?: number;
|
|
93
|
+
} | null) => void;
|
|
94
|
+
getTrackElementBadge?: (elementId: string) => unknown;
|
|
95
|
+
getSketchItems?: () => MaterialItem[];
|
|
96
|
+
getEditParam?: () => Record<string, unknown>;
|
|
97
|
+
decodeVideoPoster?: (url: string, options?: {
|
|
98
|
+
signal?: AbortSignal;
|
|
99
|
+
imageWidth?: number;
|
|
100
|
+
}) => Promise<Blob | null>;
|
|
101
|
+
addSketchItems?: (items: MaterialItem[]) => void;
|
|
102
|
+
setSketchItems?: (items: MaterialItem[]) => void;
|
|
103
|
+
[key: string]: unknown;
|
|
104
|
+
}
|
|
105
|
+
/** 内置 get/update 工程快照(不导出给宿主配置) */
|
|
106
|
+
export type AmkProjectSnapshot = {
|
|
107
|
+
projectName?: string;
|
|
108
|
+
materials?: MaterialItem[];
|
|
109
|
+
editParam?: Record<string, unknown>;
|
|
110
|
+
};
|
|
111
|
+
/** AMK 资源面板开关:false=关闭(不透传);true/不传=展示(透传 AMK 内置资源)。 */
|
|
112
|
+
type AmkResourceOptionTypes = {
|
|
113
|
+
font: boolean;
|
|
114
|
+
wordArt: boolean;
|
|
115
|
+
textAnimation: boolean;
|
|
116
|
+
transition: boolean;
|
|
117
|
+
filter: boolean;
|
|
118
|
+
effect: boolean;
|
|
119
|
+
};
|
|
120
|
+
type AmkInheritedVeVeditorOptions = Omit<VeVeditorOptions<MaterialConfig, VeVeditorI18nOptions, AmkResourceOptionTypes>, 'initialData' | 'recording' | 'onSketchItemsChange' | 'onNodePreviewError' | 'onBeforeUndo' | 'onBeforeRedo' | 'onBeforeTimestampMount' | 'onBeforeKeyframeMount' | 'onTrackChanged' | 'onRecordingUpload' | 'decode'>;
|
|
121
|
+
export type AmkEditorDecodeOptions = VeVeditorDecodeOptions;
|
|
122
|
+
export interface AmkEditorOptions extends AmkInheritedVeVeditorOptions {
|
|
123
|
+
projectId: string;
|
|
124
|
+
endpoint: string;
|
|
125
|
+
header?: AmkEditorHeaderConfig;
|
|
126
|
+
getLicenseUrl?: string | (() => string | Promise<string>);
|
|
127
|
+
decode?: AmkEditorDecodeOptions;
|
|
128
|
+
}
|
|
129
|
+
export interface AmkEditorInternalConfig {
|
|
130
|
+
projectId: string;
|
|
131
|
+
endpoint: string;
|
|
132
|
+
}
|
|
133
|
+
/** 挂载 veveditor 用的内部配置(含组装后的 initialData 等,不作为宿主 API) */
|
|
134
|
+
export interface AmkEditorConfig extends AmkEditorOptions {
|
|
135
|
+
initialData?: AmkProjectSnapshot;
|
|
136
|
+
__amkEditor: AmkEditorInternalConfig;
|
|
137
|
+
}
|
|
138
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AmkI18nInstance } from './i18n';
|
|
3
|
+
export interface UrlUploadModalViewProps {
|
|
4
|
+
visible: boolean;
|
|
5
|
+
t: AmkI18nInstance['t'];
|
|
6
|
+
/** 确认后弹窗立即关闭;上传过程由外部 Message 提示 */
|
|
7
|
+
onConfirm: (urls: string[]) => void;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
/** 支持逗号 / 换行分隔,得到回调给业务方的 url 数组 */
|
|
11
|
+
export declare function splitUrls(input: string): string[];
|
|
12
|
+
export declare function UrlUploadModalView({ visible, t, onConfirm, onClose, }: UrlUploadModalViewProps): React.ReactElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AmkI18nInstance } from './i18n';
|
|
2
|
+
export interface CreateUrlUploadModalOptions {
|
|
3
|
+
container: HTMLElement;
|
|
4
|
+
t: AmkI18nInstance['t'];
|
|
5
|
+
onConfirm: (urls: string[]) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface UrlUploadModalController {
|
|
8
|
+
open: () => void;
|
|
9
|
+
close: () => void;
|
|
10
|
+
destroy: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function createUrlUploadModal(options: CreateUrlUploadModalOptions): UrlUploadModalController;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { MaterialItem } from '../types';
|
|
2
|
+
export type SpriteState = {
|
|
3
|
+
ready: boolean;
|
|
4
|
+
pendingTaskId?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* 素材 `sprite`:
|
|
8
|
+
* - object `{ storeurls, capturenum }`:已完成;链接是否失效由实际网络请求判断
|
|
9
|
+
* - string:抽帧 taskId(进行中)
|
|
10
|
+
* - 缺省:需要新建任务
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveSpriteState(material: MaterialItem): SpriteState;
|
|
13
|
+
/** 可落盘的封面:接口返回的 http(s) URL */
|
|
14
|
+
export declare function isPersistablePosterUrl(value: unknown): boolean;
|
|
15
|
+
/** 仅会话内使用的封面:前端解码 dataURL,不落盘 */
|
|
16
|
+
export declare function isRuntimeOnlyPosterUrl(value: unknown): boolean;
|
|
17
|
+
/** http poster;有效性由实际网络请求判断 */
|
|
18
|
+
export declare function isPosterAssetReady(material: MaterialItem): boolean;
|
|
19
|
+
export declare function isExtractableVideoMaterial(material: MaterialItem): boolean;
|
|
20
|
+
export declare function resolveMaterialMediaUrl(material: MaterialItem): string;
|
|
21
|
+
export type MaterialExtractActions = {
|
|
22
|
+
url: string;
|
|
23
|
+
/** 需要新建 sprite 抽帧任务,完成后 PUT sprite=taskId */
|
|
24
|
+
createSpriteTask: boolean;
|
|
25
|
+
/** 已有 taskId,继续轮询,完成后 PUT sprite 结果 */
|
|
26
|
+
resumeSpriteTaskId?: string;
|
|
27
|
+
/**
|
|
28
|
+
* 需要抓封面:
|
|
29
|
+
* - 接口模式:缺有效 http poster(含 auth_key 过期)时抓取,http 结果 PUT 落盘
|
|
30
|
+
* - 前端解码模式:无运行时缓存时也可抓取(dataURL 不落盘)
|
|
31
|
+
*/
|
|
32
|
+
capturePoster: boolean;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* 纯判断:单个素材要不要建 sprite 任务 / 恢复轮询 / 抓封面。
|
|
36
|
+
* - enableThumbnailDecode(前端缩略图)开启时不发起 sprite 接口任务
|
|
37
|
+
* - poster / sprite 缺省时触发重抽;已有 URL 的有效性由实际网络请求判断
|
|
38
|
+
*/
|
|
39
|
+
export declare function planMaterialExtractActions(params: {
|
|
40
|
+
material: MaterialItem;
|
|
41
|
+
useFrontendThumbnails: boolean;
|
|
42
|
+
hasPosterCache: boolean;
|
|
43
|
+
}): MaterialExtractActions | null;
|