@volcengine/amk-editor 0.0.2-beta.0 → 0.0.2-beta.1

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.
@@ -6,7 +6,7 @@ export interface CreateLocalUploadModalOptions {
6
6
  onConfirm: (files: File[]) => void;
7
7
  }
8
8
  export interface LocalUploadModalController {
9
- open: (files: File[]) => void;
9
+ open: (files?: File[]) => void;
10
10
  close: () => void;
11
11
  destroy: () => void;
12
12
  }
package/dist/types.d.ts CHANGED
@@ -16,6 +16,13 @@ export type SystemMaterialItem = Omit<Partial<MaterialItem>, 'source_material_id
16
16
  type: NonNullable<MaterialItem['type']>;
17
17
  name?: string;
18
18
  };
19
+ /** 可由外部工具栏复用的素材导入入口。 */
20
+ export type AmkMaterialImportType = 'local' | 'url' | 'system';
21
+ /** Optional callbacks scoped to one externally triggered material import. */
22
+ export interface AmkMaterialImportRequestOptions {
23
+ /** Called with persisted materials only for this request. */
24
+ onMaterialsImported?: (materials: MaterialItem[]) => void | Promise<void>;
25
+ }
19
26
  /**
20
27
  * 抽帧产物存储 key 的推荐命名,仅用于提供接入提示,不属于强制素材 Schema。
21
28
  * 业务可以直接使用这两个字段,也可以把 key 放进任意自定义字段或嵌套对象。
@@ -46,6 +53,11 @@ export interface MaterialConfig {
46
53
  * 返回 `undefined` / `null` / `[]` 视为取消或未选择,不提示失败。
47
54
  */
48
55
  onUploadFromSystem?: () => Promise<SystemMaterialItem[] | undefined | null> | SystemMaterialItem[] | undefined | null;
56
+ /**
57
+ * 素材成功入库后回调(已合并 Editing API 返回的 `material_id`)。
58
+ * 本地 / URL / 资产库三条导入链路都会走到这里;失败或用户取消不会触发。
59
+ */
60
+ onMaterialsImported?: (materials: MaterialItem[]) => void | Promise<void>;
49
61
  /**
50
62
  * 刷新播放信息。未配置时用素材库已有字段;
51
63
  * 配置后:入参为待刷新素材列表(按服务端 material_id 区分,支持批量),
@@ -67,10 +79,22 @@ export interface MaterialConfig {
67
79
  material: MaterialItem;
68
80
  }) => Promise<PersistExtractUrlsResult | string[]> | PersistExtractUrlsResult | string[];
69
81
  }
82
+ export interface AmkEditorHeaderTitleUpdateSuccess {
83
+ readonly projectId: string;
84
+ /** Project title persisted successfully by the Editing API. */
85
+ readonly title: string;
86
+ }
70
87
  export interface AmkEditorHeaderConfig {
71
88
  show?: boolean;
89
+ /**
90
+ * When set, the header is rendered into this element instead of inside the
91
+ * editor root. Use this to place a full-width header above a host split layout.
92
+ */
93
+ mount?: HTMLElement;
72
94
  onBack?: () => void;
73
95
  onClose?: () => void;
96
+ /** Fired only after the project title is persisted successfully. */
97
+ onTitleUpdateSuccess?: (change: AmkEditorHeaderTitleUpdateSuccess) => void;
74
98
  }
75
99
  export interface AmkEditorExportConfig {
76
100
  /**
@@ -181,16 +205,14 @@ type AmkResourceOptionTypes = {
181
205
  };
182
206
  type AmkInheritedVeVeditorOptions = Omit<VeVeditorOptions<MaterialConfig, VeVeditorI18nOptions, AmkResourceOptionTypes>, 'initialData' | 'recording' | 'onSketchItemsChange' | 'onNodePreviewError' | 'onPreviewNodeRefresh' | 'onBeforeUndo' | 'onBeforeRedo' | 'onBeforeTimestampMount' | 'onBeforeKeyframeMount' | 'onTrackChanged' | 'onRecordingUpload' | 'decode'>;
183
207
  export type AmkEditorDecodeOptions = VeVeditorDecodeOptions;
184
- /** 客户业务代理的浏览器侧鉴权配置。SDK 不约定鉴权协议,仅透传接入方返回的请求头。 */
185
- export interface AmkEditorAuthConfig {
186
- getHeaders: () => Record<string, string> | undefined | Promise<Record<string, string> | undefined>;
187
- }
208
+ /** 每次 AMK 请求前动态获取、原样透传给 endpoint 的业务请求头。 */
209
+ export type AmkEditorGetHeaders = () => Readonly<Record<string, string>> | undefined | Promise<Readonly<Record<string, string>> | undefined>;
188
210
  export interface AmkEditorOptions extends AmkInheritedVeVeditorOptions {
189
211
  projectId: string;
190
212
  /** AMK Editing API 的业务代理地址。 */
191
213
  endpoint: string;
192
- /** 可选:返回访问客户业务代理所需的自定义请求头。 */
193
- auth?: AmkEditorAuthConfig;
214
+ /** 每次请求前调用;返回值不解析、不改写,仅透传给 endpoint。 */
215
+ getHeaders?: AmkEditorGetHeaders;
194
216
  header?: AmkEditorHeaderConfig;
195
217
  export?: AmkEditorExportConfig;
196
218
  getLicenseUrl?: string | (() => string | Promise<string>);