@volcengine/amk-editor 0.0.2 → 0.0.3

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.
@@ -5,6 +5,23 @@
5
5
  * 避免公网用户安装 amk-editor 时还需要访问内网依赖。
6
6
  */
7
7
  export type VeVeditorTheme = 'light' | 'dark';
8
+ export type VeVeditorMediaErrorCategory = 'aborted' | 'network' | 'network_or_cors' | 'decode' | 'unsupported' | 'cors' | 'render' | 'initialization' | 'unknown';
9
+ export interface VeVeditorMediaError {
10
+ name: 'VideoEditorMediaError';
11
+ type: 'video' | 'audio' | 'image' | string;
12
+ phase: 'init' | 'load' | 'decode' | 'render';
13
+ code: string;
14
+ category: VeVeditorMediaErrorCategory;
15
+ message: string;
16
+ url?: string;
17
+ nativeCode?: number;
18
+ possibleCauses: string[];
19
+ cause?: {
20
+ name?: string;
21
+ message: string;
22
+ };
23
+ originalEvent?: Event;
24
+ }
8
25
  export interface VeVeditorMaterialItem {
9
26
  id?: string;
10
27
  type?: 'video' | 'audio' | 'image' | string;
@@ -104,8 +121,8 @@ export interface VeVeditorOptions<TMaterialOptions = VeVeditorMaterialOptions, T
104
121
  action?: 'delete' | 'add';
105
122
  item?: unknown;
106
123
  }) => void;
107
- onNodePreviewError?: (type: 'video' | 'audio', node: unknown) => void;
108
- onPreviewNodeRefresh?: (type: 'video' | 'audio', node: unknown) => void | Promise<void>;
124
+ onNodePreviewError?: (type: 'video' | 'audio' | 'image', node: unknown, error?: VeVeditorMediaError) => void;
125
+ onPreviewNodeRefresh?: (type: 'video' | 'audio' | 'image', node: unknown) => void | Promise<void>;
109
126
  onBeforeUndo?: (payload: unknown) => boolean | void;
110
127
  onBeforeRedo?: (payload: unknown) => boolean | void;
111
128
  onBeforeTimestampMount?: (params: Record<string, unknown>) => boolean | Promise<boolean>;
@@ -1,7 +1,9 @@
1
1
  import type { MaterialItem } from './types';
2
2
  /**
3
3
  * 业务方回写的播放信息补丁;未返回的字段保持原样。
4
- * SDK 内部 material_id 匹配目标素材;可更新 url / poster / sprite / source_material_id 等。
4
+ * 优先按 SDK 内部 material_id 匹配,随后按业务 source_material_id 兜底;
5
+ * 两个标识都没有的补丁才按数组下标兜底。
6
+ * 可更新 url / poster / sprite / source_material_id 等。
5
7
  * material_id 为 SDK 内部字段,补丁中的同名字段会被忽略。
6
8
  */
7
9
  export type MaterialPlayInfoPatch = Partial<MaterialItem> & {
@@ -4,6 +4,6 @@ export type TaskPollingController = {
4
4
  };
5
5
  export declare function startTaskPolling(options: {
6
6
  poll: () => Promise<boolean>;
7
- onError?: (error: unknown) => void;
7
+ onError?: (error: unknown) => void | Promise<void>;
8
8
  getDelayMs?: (attempt: number) => number;
9
9
  }): TaskPollingController;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 查询任务信息 API 的官方响应状态。
3
+ * @see https://docs.volcengine.com/docs/6448/2278532?lang=zh
4
+ */
5
+ export type AmkTaskQueryStatus = 'running' | 'completed' | 'failed';
6
+ /**
7
+ * `success` 表示查询请求本身是否成功;查询成功后才读取任务 `status`。
8
+ * 非官方响应同样按失败收口,避免未知响应被无限轮询。
9
+ */
10
+ export declare function resolveAmkTaskQueryStatus(payload: unknown): AmkTaskQueryStatus;
package/dist/types.d.ts CHANGED
@@ -60,7 +60,8 @@ export interface MaterialConfig {
60
60
  onMaterialsImported?: (materials: MaterialItem[]) => void | Promise<void>;
61
61
  /**
62
62
  * 刷新播放信息。未配置时用素材库已有字段;
63
- * 配置后:入参为待刷新素材列表(按服务端 material_id 区分,支持批量),
63
+ * 配置后:入参为待刷新素材列表,支持批量;返回补丁优先按 material_id 匹配,
64
+ * source_material_id 次之,两者都未返回时才按数组顺序兜底,
64
65
  * 返回单条或数组补丁覆盖原素材的播放字段(url / poster / sprite / source_material_id 等)。
65
66
  * 补丁不得改写 material_id(服务端字段,业务传了也不入库)。
66
67
  */
@@ -1393,6 +1393,12 @@
1393
1393
  gap: 12px;
1394
1394
  color: #c95b25;
1395
1395
  }
1396
+ .amk-editor-header-export-task-submitted-time {
1397
+ color: #86909c;
1398
+ font-size: 12px;
1399
+ font-variant-numeric: tabular-nums;
1400
+ white-space: nowrap;
1401
+ }
1396
1402
  .amk-editor-header-export-task-row-actions button {
1397
1403
  padding: 0;
1398
1404
  color: inherit;
@@ -1960,6 +1966,9 @@
1960
1966
  [data-theme='dark'] .amk-editor-header-export-task-row-actions {
1961
1967
  color: #ff9a5c;
1962
1968
  }
1969
+ [data-theme='dark'] .amk-editor-header-export-task-submitted-time {
1970
+ color: #85858f;
1971
+ }
1963
1972
  [data-theme='dark'] .amk-editor-header-export-task-row-actions button.is-error {
1964
1973
  color: #ff6b6b;
1965
1974
  }
@@ -2146,8 +2155,9 @@
2146
2155
  border-color: #165dff;
2147
2156
  }
2148
2157
  .amk-editor-local-upload-dropzone:focus-visible {
2149
- outline: 2px solid #165dff;
2150
- outline-offset: 2px;
2158
+ outline: none;
2159
+ border-color: #165dff;
2160
+ box-shadow: inset 0 0 0 1px #165dff;
2151
2161
  }
2152
2162
  .amk-editor-local-upload-dropzone:disabled {
2153
2163
  cursor: not-allowed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcengine/amk-editor",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "AMK scenario editor wrapper for VeVeditor",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {