@vvfx/sdk 0.1.19-alpha.37 → 0.1.19-alpha.38

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.
Files changed (96) hide show
  1. package/LICENSE +22 -0
  2. package/dist/index.js +87037 -14
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.mjs +87141 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/src/config.d.ts +855 -0
  7. package/dist/src/exporter/config.d.ts +18 -0
  8. package/dist/src/exporter/const.d.ts +71 -0
  9. package/dist/src/exporter/export-media.d.ts +68 -0
  10. package/dist/src/exporter/exporter.d.ts +22 -0
  11. package/dist/src/exporter/index.d.ts +2 -0
  12. package/dist/src/exporter/types.d.ts +194 -0
  13. package/dist/src/exporter/utils.d.ts +22 -0
  14. package/dist/src/exporter/wav-audio.d.ts +27 -0
  15. package/dist/src/gesture-handler/gizmo/adsorption-gizmo.d.ts +68 -0
  16. package/dist/src/gesture-handler/gizmo/control-gizmo.d.ts +67 -0
  17. package/dist/src/gesture-handler/gizmo/gizmo.d.ts +59 -0
  18. package/dist/src/gesture-handler/gizmo/icon-gizmo.d.ts +44 -0
  19. package/dist/src/gesture-handler/gizmo/index.d.ts +6 -0
  20. package/dist/src/gesture-handler/gizmo/item-create-gizmo.d.ts +43 -0
  21. package/dist/src/gesture-handler/gizmo/loading-gizmo.d.ts +48 -0
  22. package/dist/src/gesture-handler/gizmo/mask-gizmo.d.ts +113 -0
  23. package/dist/src/gesture-handler/gizmo/picture-cut-gizmo.d.ts +94 -0
  24. package/dist/src/gesture-handler/gizmo/picture-expand-gizmo.d.ts +57 -0
  25. package/dist/src/gesture-handler/gizmo/preference-gizmo.d.ts +32 -0
  26. package/dist/src/gesture-handler/gizmo/selector-gizmo.d.ts +101 -0
  27. package/dist/src/gesture-handler/gizmo/sprite-text-edit-gizmo.d.ts +36 -0
  28. package/dist/src/gesture-handler/gizmo/text-gizmo.d.ts +128 -0
  29. package/dist/src/gesture-handler/gizmo/transform-gizmo.d.ts +233 -0
  30. package/dist/src/gesture-handler/gizmo/type.d.ts +402 -0
  31. package/dist/src/gesture-handler/index.d.ts +3 -0
  32. package/dist/src/gesture-handler/src/gesture-handler.d.ts +143 -0
  33. package/dist/src/gesture-handler/src/icons.d.ts +7 -0
  34. package/dist/src/gesture-handler/utils.d.ts +2 -0
  35. package/dist/src/html-overlay/document-runtime.d.ts +3 -0
  36. package/dist/src/html-overlay/document-transform.d.ts +7 -0
  37. package/dist/src/html-overlay/index.d.ts +1 -0
  38. package/dist/src/html-overlay/manager.d.ts +43 -0
  39. package/dist/src/html-overlay/mime-utils.d.ts +2 -0
  40. package/dist/src/html-overlay/path-utils.d.ts +8 -0
  41. package/dist/src/index.d.ts +14 -0
  42. package/dist/src/math/box2.d.ts +166 -0
  43. package/dist/src/math/circle.d.ts +82 -0
  44. package/dist/src/math/euler.d.ts +20 -0
  45. package/dist/src/math/index.d.ts +13 -0
  46. package/dist/src/math/line2.d.ts +93 -0
  47. package/dist/src/math/line3.d.ts +17 -0
  48. package/dist/src/math/matrix4.d.ts +28 -0
  49. package/dist/src/math/plane.d.ts +14 -0
  50. package/dist/src/math/quaternion.d.ts +3 -0
  51. package/dist/src/math/ray-caster.d.ts +10 -0
  52. package/dist/src/math/ray.d.ts +18 -0
  53. package/dist/src/math/type.d.ts +32 -0
  54. package/dist/src/math/utils.d.ts +19 -0
  55. package/dist/src/math/vector2.d.ts +30 -0
  56. package/dist/src/math/vector3.d.ts +29 -0
  57. package/dist/src/screen-shot/index.d.ts +1 -0
  58. package/dist/src/screen-shot/screen-shot.d.ts +35 -0
  59. package/dist/src/sdk-item/base-item.d.ts +126 -0
  60. package/dist/src/sdk-item/card-item.d.ts +57 -0
  61. package/dist/src/sdk-item/effects-item.d.ts +70 -0
  62. package/dist/src/sdk-item/frame-item.d.ts +112 -0
  63. package/dist/src/sdk-item/generator-item.d.ts +86 -0
  64. package/dist/src/sdk-item/group-item.d.ts +57 -0
  65. package/dist/src/sdk-item/index.d.ts +36 -0
  66. package/dist/src/sdk-item/sprite-item.d.ts +67 -0
  67. package/dist/src/sdk-item/text-item.d.ts +107 -0
  68. package/dist/src/sdk-item/types.d.ts +153 -0
  69. package/dist/src/sdk-item/video-item.d.ts +87 -0
  70. package/dist/src/sdk.d.ts +589 -0
  71. package/dist/src/service/UndoRedo.d.ts +48 -0
  72. package/dist/src/shared/index.d.ts +1 -0
  73. package/dist/src/shared/player.d.ts +9 -0
  74. package/dist/src/size-adapte/index.d.ts +1 -0
  75. package/dist/src/size-adapte/size-adapt.d.ts +28 -0
  76. package/dist/src/types.d.ts +1235 -0
  77. package/dist/src/utils/background-manager.d.ts +72 -0
  78. package/dist/src/utils/common-utils.d.ts +28 -0
  79. package/dist/src/utils/index.d.ts +8 -0
  80. package/dist/src/utils/interaction-utils.d.ts +60 -0
  81. package/dist/src/utils/json-data-utils.d.ts +165 -0
  82. package/dist/src/utils/layout-utils.d.ts +219 -0
  83. package/dist/src/utils/page-data-utils.d.ts +370 -0
  84. package/dist/src/utils/player-data-utils.d.ts +11 -0
  85. package/dist/src/utils/types.d.ts +114 -0
  86. package/dist/src/wireframe/common/box.d.ts +1 -0
  87. package/dist/src/wireframe/common/dashed-line.d.ts +1 -0
  88. package/dist/src/wireframe/common/line.d.ts +1 -0
  89. package/dist/src/wireframe/common/pixi-ext.d.ts +11 -0
  90. package/dist/src/wireframe/common/pixi.d.ts +18 -0
  91. package/dist/src/wireframe/index.d.ts +4 -0
  92. package/package.json +41 -23
  93. package/dist/index.cjs +0 -14
  94. package/dist/index.d.cts +0 -4891
  95. package/dist/index.d.ts +0 -4891
  96. package/dist/index.global.js +0 -333
@@ -0,0 +1,1235 @@
1
+ import type { spec } from './shared';
2
+ import { SizeAdaptDirection } from './size-adapte';
3
+ import type { ExportMediaItemOptions } from './exporter';
4
+ import { SDKItemType } from './sdk-item/types';
5
+ import { SDKItem } from './sdk-item';
6
+ import { GlobalLayoutMode } from './utils';
7
+ export type BaseItemProperty = {
8
+ position: [number, number];
9
+ rotation: [number, number, number];
10
+ scale: [number, number];
11
+ width: number;
12
+ height: number;
13
+ };
14
+ export type SpriteItemProperty = BaseItemProperty & {
15
+ image: string;
16
+ };
17
+ export type GroupItemProperty = BaseItemProperty & {
18
+ children: string[];
19
+ };
20
+ export type TextItemProperty = BaseItemProperty & {
21
+ fontFamily: string;
22
+ color: [number, number, number, number];
23
+ fontWeight: spec.TextWeight;
24
+ text: string;
25
+ textAlign: spec.TextAlignment;
26
+ fontSize: number;
27
+ fontStyle: spec.FontStyle;
28
+ lineHeight: number;
29
+ outlineColor?: spec.vec4;
30
+ outlineWidth?: number;
31
+ /**
32
+ * @description 描边开关
33
+ */
34
+ outlineEnabled?: boolean;
35
+ /**
36
+ * @description 文本字间距
37
+ */
38
+ letterSpacing?: number;
39
+ fontUrl?: string;
40
+ };
41
+ export type VideoItemProperty = BaseItemProperty & {
42
+ video: string;
43
+ /**
44
+ * @description 是否静音
45
+ */
46
+ muted?: boolean;
47
+ /**
48
+ * @description 是否为透明视频
49
+ */
50
+ transparent?: boolean;
51
+ /**
52
+ * @description 播放速率
53
+ */
54
+ playbackRate?: number;
55
+ /**
56
+ * @description 音量
57
+ */
58
+ volume?: number;
59
+ };
60
+ /**
61
+ * @description Generator 表单属性
62
+ */
63
+ export type GeneratorItemProperty = BaseItemProperty & {
64
+ /**
65
+ * @description 生成器类型
66
+ */
67
+ generatorType: 'image' | 'video';
68
+ };
69
+ export type EffectsItemProperty = BaseItemProperty & {
70
+ effects: string;
71
+ children?: string[];
72
+ };
73
+ /**
74
+ * @description Card HTML 覆盖层清理函数。
75
+ */
76
+ export type CardHTMLRenderCleanup = () => void;
77
+ /**
78
+ * @description Card HTML 覆盖层 DOM 渲染函数。SDK 会传入 overlay 容器,可返回清理函数。
79
+ */
80
+ export type CardHTMLDOMRenderer = ((container: HTMLElement) => void) | ((container: HTMLElement) => CardHTMLRenderCleanup);
81
+ /**
82
+ * @description Card HTML 单文件字符串内容。SDK 会通过 iframe srcdoc 渲染。
83
+ */
84
+ export type CardHTMLInlineContent = {
85
+ /**
86
+ * @description 内容类型标识
87
+ */
88
+ kind: 'inline';
89
+ /**
90
+ * @description HTML 字符串内容
91
+ */
92
+ html: string;
93
+ };
94
+ /**
95
+ * @description Card HTML DOM 渲染内容。用于挂载 React/Vue/原生 DOM 等组件。
96
+ */
97
+ export type CardHTMLDOMRendererContent = {
98
+ /**
99
+ * @description 内容类型标识
100
+ */
101
+ kind: 'dom';
102
+ /**
103
+ * @description DOM 挂载目标。host 为宿主 DOM,iframe 为隔离文档 DOM;默认 host。
104
+ */
105
+ target?: 'host' | 'iframe';
106
+ /**
107
+ * @description DOM 渲染函数
108
+ */
109
+ render: CardHTMLDOMRenderer;
110
+ };
111
+ /**
112
+ * @description Card HTML 文档到宿主的消息。仅当 allowHostMessaging 为 true 时 SDK 才会接收。
113
+ */
114
+ export type CardHTMLDocumentMessage = {
115
+ /**
116
+ * @description 消息来源标识,必须为 vvfx-card-html。
117
+ */
118
+ source: 'vvfx-card-html';
119
+ /**
120
+ * @description 业务消息类型。
121
+ */
122
+ type: string;
123
+ /**
124
+ * @description 业务消息负载。
125
+ */
126
+ payload?: unknown;
127
+ };
128
+ /**
129
+ * @description Card HTML 文档内容。用于承载 AI Agent 生成的完整 HTML 页面或多文件产物。
130
+ */
131
+ export type CardHTMLDocumentContent = {
132
+ /**
133
+ * @description 内容类型标识
134
+ */
135
+ kind: 'document';
136
+ /**
137
+ * @description 入口文件路径,例如 index.html
138
+ */
139
+ entry: string;
140
+ /**
141
+ * @description 文件内容表,key 为相对路径,value 为文件内容
142
+ */
143
+ files: Record<string, string>;
144
+ /**
145
+ * @description 资源解析基准路径,用于后续处理远程或本地资源引用
146
+ */
147
+ baseUrl?: string;
148
+ /**
149
+ * @description iframe sandbox 配置;true/undefined 使用 SDK 默认沙箱 allow-scripts;false 不加 sandbox,风险较高,不建议用于不可信内容。
150
+ */
151
+ sandbox?: boolean | string;
152
+ /**
153
+ * @description 是否允许 iframe 通过 postMessage 与宿主通信;默认 false。
154
+ */
155
+ allowHostMessaging?: boolean;
156
+ /**
157
+ * @description iframe 消息回调。仅接收来自当前 iframe 且 source 为 vvfx-card-html 的消息。
158
+ */
159
+ onMessage?: (message: CardHTMLDocumentMessage) => void;
160
+ };
161
+ /**
162
+ * @description Card HTML 覆盖层内容。
163
+ */
164
+ export type CardHTMLContent = CardHTMLInlineContent | CardHTMLDOMRendererContent | CardHTMLDocumentContent;
165
+ /**
166
+ * @description Card 卡片元素属性
167
+ */
168
+ export type CardItemProperty = BaseItemProperty & {
169
+ /**
170
+ * @description 卡片类型(动态配置,需在 SDK.config.itemConfig.cardConfig.cardTypes 中注册)
171
+ */
172
+ cardType: string;
173
+ /**
174
+ * @description HTML 覆盖层内容;存在该字段时由 DOM overlay 渲染
175
+ */
176
+ htmlContent?: CardHTMLContent;
177
+ };
178
+ /**
179
+ * @description Frame 画板元素布局模式
180
+ */
181
+ export declare enum FrameLayoutMode {
182
+ AUTO = "auto",
183
+ FREE = "free"
184
+ }
185
+ /**
186
+ * @description 自动布局配置
187
+ */
188
+ export type AutoLayoutConfig = {
189
+ /**
190
+ * @description 单行最大宽度(像素),超过后自动换行。未设置时不限制
191
+ */
192
+ maxRowWidth?: number;
193
+ /**
194
+ * @description 最大行数限制。未设置时不限制
195
+ */
196
+ maxRowCount?: number;
197
+ };
198
+ /**
199
+ * @description 元素在自动布局中的位置信息
200
+ */
201
+ export type LayoutInfo = {
202
+ /**
203
+ * @description 所在行号(可为小数)
204
+ * 整数部分:主行号(0, 1, 2...)
205
+ * 小数部分:分行后的子行号(如 1.5 表示第1行的第5个子行)
206
+ * 仅支持两层(即小数部分为 0-9)
207
+ */
208
+ row: number;
209
+ /**
210
+ * @description 所在列号(必须为整数)
211
+ */
212
+ column: number;
213
+ /**
214
+ * @description 元素在布局中的位置(相对于画板左上角,可选)
215
+ */
216
+ position?: [number, number];
217
+ };
218
+ /**
219
+ * @description Frame 画板元素属性
220
+ */
221
+ export type FrameItemProperty = BaseItemProperty & {
222
+ /**
223
+ * @description 布局模式: auto - 自动布局, free - 自由布局
224
+ */
225
+ layoutMode: FrameLayoutMode;
226
+ /**
227
+ * @description 子元素ID数组
228
+ */
229
+ children: string[];
230
+ /**
231
+ * @description 自动布局配置
232
+ */
233
+ autoLayoutConfig?: AutoLayoutConfig;
234
+ /**
235
+ * @description 子元素布局位置信息(用于自动布局)
236
+ * key: 子元素ID, value: 元素的位置信息
237
+ */
238
+ layoutInfos?: Record<string, LayoutInfo>;
239
+ };
240
+ /**
241
+ * @description BaseItem 基础属性键名
242
+ */
243
+ export type BaseItemPropertyKey = 'name' | 'duration' | 'delay' | 'endBehavior' | 'visible' | 'isLocked' | 'parentId';
244
+ /**
245
+ * @description BaseItem 基础属性值类型映射
246
+ */
247
+ export type BaseItemPropertyValueMap = {
248
+ name: string;
249
+ duration: number;
250
+ delay: number;
251
+ endBehavior: spec.EndBehavior;
252
+ visible: boolean;
253
+ isLocked: boolean;
254
+ parentId?: string;
255
+ };
256
+ /**
257
+ * @description Item 类型与 Property 类型的映射
258
+ */
259
+ export type ItemPropertyMap = {
260
+ [SDKItemType.SPRITE]: SpriteItemProperty;
261
+ [SDKItemType.TEXT]: TextItemProperty;
262
+ [SDKItemType.VIDEO]: VideoItemProperty;
263
+ [SDKItemType.GROUP]: GroupItemProperty;
264
+ [SDKItemType.GENERATOR]: GeneratorItemProperty;
265
+ [SDKItemType.EFFECTS]: EffectsItemProperty;
266
+ [SDKItemType.FRAME]: FrameItemProperty;
267
+ [SDKItemType.CARD]: CardItemProperty;
268
+ };
269
+ /**
270
+ * @description 场景1:单个元素单个属性设置
271
+ * 支持设置 BaseItem 基础属性或具体 Item 类型的 property 属性
272
+ */
273
+ export type SetSingleItemSinglePropertyParam<T extends SDKItemType = SDKItemType> = {
274
+ itemId: string;
275
+ type: T;
276
+ propertyName: BaseItemPropertyKey;
277
+ propertyValue: BaseItemPropertyValueMap[BaseItemPropertyKey];
278
+ } | {
279
+ itemId: string;
280
+ type: T;
281
+ propertyName: keyof ItemPropertyMap[T];
282
+ propertyValue: ItemPropertyMap[T][keyof ItemPropertyMap[T]];
283
+ };
284
+ /**
285
+ * @description 场景2:单个元素多个属性设置
286
+ * 同时设置多个 BaseItem 属性或 property 属性
287
+ */
288
+ export type SetSingleItemMultiplePropertiesParam<T extends SDKItemType = SDKItemType> = {
289
+ itemId: string;
290
+ type: T;
291
+ property: Partial<Record<BaseItemPropertyKey, BaseItemPropertyValueMap[BaseItemPropertyKey]>> & Partial<Record<keyof ItemPropertyMap[T], ItemPropertyMap[T][keyof ItemPropertyMap[T]]>>;
292
+ };
293
+ /**
294
+ * @description 设置元素属性的统一参数类型
295
+ * 支持两种场景:单元素单属性、单元素多属性
296
+ */
297
+ export type SetItemPropertyParam<T extends SDKItemType = SDKItemType> = SetSingleItemSinglePropertyParam<T> | SetSingleItemMultiplePropertiesParam<T>;
298
+ export type SDKOptions = {
299
+ /** 导出视频时,是否开启转码日志 */
300
+ loggerInExportVideoTranscoding?: boolean;
301
+ };
302
+ export type SDKInputParam = SDKTemplateInputParam | SDKEditorInputParam;
303
+ /**
304
+ * @description SDK入参
305
+ */
306
+ export type SDKTemplateInputParam = {
307
+ /**
308
+ * @description JSON地址
309
+ */
310
+ scene: string | spec.JSONScene;
311
+ /**
312
+ * @description SDK模式 - 模板编辑模式
313
+ */
314
+ mode: 'template';
315
+ /**
316
+ * @description 视图参数
317
+ */
318
+ viewParams?: ViewParam[];
319
+ /**
320
+ * @description 页面属性
321
+ */
322
+ options: PageOptions;
323
+ };
324
+ export type SDKEditorInputParam = {
325
+ /**
326
+ * @description SDK模式 - 编辑器模式
327
+ */
328
+ mode: 'editor';
329
+ };
330
+ export type SDKInitParam = {
331
+ scene: spec.JSONScene;
332
+ /**
333
+ * @description 视图参数
334
+ */
335
+ viewParams: ViewParam[];
336
+ /**
337
+ * @description 页面属性
338
+ */
339
+ options: PageOptions;
340
+ };
341
+ /**
342
+ * @description 页面属性
343
+ */
344
+ export type PageOptions = {
345
+ /**
346
+ * @description 同步模式开关
347
+ */
348
+ asyncMode: boolean;
349
+ /**
350
+ * @description 安全区展示开关
351
+ */
352
+ safeAreaPreview: boolean;
353
+ /**
354
+ * @description 吸附开关
355
+ */
356
+ adsorption: boolean;
357
+ };
358
+ /**
359
+ * @description 页面数据
360
+ */
361
+ export type PageData = {
362
+ /**
363
+ * @description 基础场景数据
364
+ */
365
+ scene: spec.JSONScene;
366
+ /**
367
+ * @description 页面属性
368
+ */
369
+ property: PageProperty;
370
+ /**
371
+ * @description 视图属性
372
+ */
373
+ viewProperties: ViewProperty[];
374
+ /**
375
+ * @description 活跃数据
376
+ */
377
+ activeData: ActiveData;
378
+ /**
379
+ * @description 元素数据
380
+ */
381
+ items: SDKItem[];
382
+ /**
383
+ * @description 视图当前时间
384
+ */
385
+ time: number;
386
+ /**
387
+ * @description 是否处于播放态
388
+ */
389
+ playing: boolean;
390
+ };
391
+ /**
392
+ * @description 页面自动布局参数
393
+ */
394
+ export type PageAutoLayoutParam = {
395
+ /**
396
+ * @description 自动布局模式
397
+ */
398
+ mode?: GlobalLayoutMode;
399
+ /**
400
+ * @description 选中元素【无输入值时,页面内所有元素排布】
401
+ * 如果是选中元素自动排布,则保证包围盒左上角点位置相同
402
+ */
403
+ ids?: string[];
404
+ /**
405
+ * @description 排布后是否聚焦元素,默认开启
406
+ */
407
+ focus?: boolean;
408
+ /**
409
+ * @description 自动布局间隔
410
+ */
411
+ gap?: number;
412
+ };
413
+ /**
414
+ * @description 页面配置
415
+ */
416
+ export type PageConfig = {
417
+ /**
418
+ * @description 出血区域展示开关
419
+ */
420
+ safeAreaPreview: boolean;
421
+ /**
422
+ * @description 缩放值
423
+ */
424
+ zoom: number;
425
+ /**
426
+ * @description 吸附开关
427
+ */
428
+ adsorption: boolean;
429
+ /**
430
+ * @description 同步开关
431
+ */
432
+ asyncMode: boolean;
433
+ /**
434
+ * @description 画布移动
435
+ */
436
+ translation: spec.vec2;
437
+ };
438
+ /**
439
+ * @description 页面属性
440
+ */
441
+ export type PageProperty = {
442
+ /**
443
+ * @description 出血区域展示开关
444
+ */
445
+ safeAreaPreview: boolean;
446
+ /**
447
+ * @description 缩放值
448
+ */
449
+ zoom: number;
450
+ /**
451
+ * @description 偏移值
452
+ */
453
+ translation: [number, number];
454
+ /**
455
+ * @description 吸附开关
456
+ */
457
+ adsorption: boolean;
458
+ /**
459
+ * @description 同步开关
460
+ */
461
+ asyncMode: boolean;
462
+ };
463
+ /**
464
+ * @description 视图创建参数
465
+ */
466
+ export type ViewParam = {
467
+ /**
468
+ * @description 页面尺寸
469
+ */
470
+ size?: [number, number];
471
+ /**
472
+ * @description 出血区参数
473
+ */
474
+ safeArea?: [number, number, number, number];
475
+ /**
476
+ * @description 自适应方向 - 默认根据视图宽高决定
477
+ */
478
+ adaptionDirection?: SizeAdaptDirection;
479
+ /**
480
+ * @description 自定义出血区 - 用于展示
481
+ */
482
+ previewSafeAreas?: PreviewSafeAreaParam[];
483
+ /**
484
+ * @description 导出参数
485
+ */
486
+ export: ExportParam;
487
+ };
488
+ /**
489
+ * @description 导出参数
490
+ */
491
+ export type ExportParam = {
492
+ /**
493
+ * @description 视频名称
494
+ */
495
+ name?: string;
496
+ } & Omit<ExportMediaItemOptions, 'scene' | 'size'>;
497
+ /**
498
+ * @description 视图属性
499
+ */
500
+ export type ViewProperty = {
501
+ /**
502
+ * @description 视图ID
503
+ */
504
+ id: number;
505
+ /**
506
+ * @description 视图宽高
507
+ */
508
+ size: [number, number];
509
+ /**
510
+ * @description 出血区数据
511
+ */
512
+ safeArea: [number, number, number, number];
513
+ /**
514
+ * @description 自定义出血区数据
515
+ */
516
+ previewSafeAreas: PreviewSafeAreaParam[];
517
+ /**
518
+ * @description 视图场景数据
519
+ */
520
+ scene: spec.JSONScene;
521
+ /**
522
+ * @description 导出参数
523
+ */
524
+ export: ExportParam;
525
+ /**
526
+ * @description 忽略交互 - 仅供展示
527
+ */
528
+ ignoreInteraction: boolean;
529
+ };
530
+ /**
531
+ * @description 自定义出血区数据
532
+ */
533
+ export type PreviewSafeAreaParam = {
534
+ /**
535
+ * @description 出血区包围盒 [left top width height]
536
+ */
537
+ box: [number, number, number, number];
538
+ /**
539
+ * @description 出血区色块颜色 默认为 [255, 255, 255, 0.3]
540
+ */
541
+ color?: [number, number, number, number];
542
+ /**
543
+ * @description 出血区图像
544
+ */
545
+ url?: string;
546
+ /**
547
+ * @description 出血区是否可见
548
+ */
549
+ visible?: boolean;
550
+ };
551
+ /**
552
+ * @description 页面活跃数据
553
+ */
554
+ export type ActiveData = {
555
+ /**
556
+ * @description 视图ID
557
+ */
558
+ view?: number;
559
+ /**
560
+ * @description 选中元素
561
+ */
562
+ selectedItems: string[];
563
+ /**
564
+ * @description 预选中元素
565
+ */
566
+ preSelectedItem?: string;
567
+ /**
568
+ * @description 执行中元素
569
+ */
570
+ loadingItems?: string[];
571
+ };
572
+ /**
573
+ * @description Generator 扩展配置
574
+ * 用于 GeneratorMetadataManager 返回的数据格式
575
+ */
576
+ export type GeneratorExtension = {
577
+ /**
578
+ * @description 扩展类型标识
579
+ */
580
+ type: 'generator';
581
+ /**
582
+ * @description Generator 子类型
583
+ */
584
+ generatorType: 'sprite' | 'video';
585
+ /**
586
+ * @description 填充颜色 [r, g, b, a],范围 0-1
587
+ */
588
+ fillColor: [number, number, number, number];
589
+ /**
590
+ * @description 图标 URL
591
+ */
592
+ iconUrl: string;
593
+ };
594
+ export type SDKBackgroundType = 'color' | 'image' | 'chess-board' | 'dot-board';
595
+ /**
596
+ * @description 图层创建信息
597
+ */
598
+ export type SpriteCreateInfo = {
599
+ type: SDKItemType.SPRITE;
600
+ /**
601
+ * @description 图层名称
602
+ */
603
+ name?: string;
604
+ /**
605
+ * @description 元素id
606
+ */
607
+ id?: string;
608
+ /**
609
+ * @description 父节点id
610
+ */
611
+ parentId?: string;
612
+ /**
613
+ * @description 扩展属性
614
+ */
615
+ extension?: Record<string, any>;
616
+ /**
617
+ * @description 元素属性
618
+ */
619
+ property: {
620
+ /**
621
+ * @description 图片资源地址 | 数据
622
+ */
623
+ image?: string;
624
+ /**
625
+ * @description 图层像素宽度
626
+ */
627
+ width: number;
628
+ /**
629
+ * @description 图层像素高度
630
+ */
631
+ height: number;
632
+ /**
633
+ * @description 元素位置
634
+ */
635
+ position: [number, number];
636
+ /**
637
+ * @description 元素旋转 z | [x, y, z]
638
+ */
639
+ rotation?: number | [number, number, number];
640
+ /**
641
+ * @description 元素缩放
642
+ */
643
+ scale?: [number, number];
644
+ };
645
+ };
646
+ /**
647
+ * @description 组 元素创建信息
648
+ */
649
+ export type GroupCreateInfo = {
650
+ type: SDKItemType.GROUP;
651
+ /**
652
+ * @description 元素id
653
+ */
654
+ id?: string;
655
+ /**
656
+ * @description 父节点id
657
+ */
658
+ parentId?: string;
659
+ /**
660
+ * @description 元素名称
661
+ */
662
+ name?: string;
663
+ /**
664
+ * @description 扩展属性
665
+ */
666
+ extension?: Record<string, any>;
667
+ /**
668
+ * @description 元素属性
669
+ */
670
+ property: {
671
+ /**
672
+ * @description 元素位置
673
+ */
674
+ position?: [number, number];
675
+ /**
676
+ * @description 元素旋转 z | [x, y, z]
677
+ */
678
+ rotation?: number | [number, number, number];
679
+ /**
680
+ * @description 元素缩放
681
+ */
682
+ scale?: [number, number];
683
+ /**
684
+ * @description 子元素id
685
+ */
686
+ children: string[];
687
+ };
688
+ };
689
+ /**
690
+ * @description 文本创建信息
691
+ */
692
+ export type TextCreateInfo = {
693
+ type: SDKItemType.TEXT;
694
+ /**
695
+ * @description 元素id
696
+ */
697
+ id?: string;
698
+ /**
699
+ * @description 父节点id
700
+ */
701
+ parentId?: string;
702
+ /**
703
+ * @description 元素名称
704
+ */
705
+ name?: string;
706
+ /**
707
+ * @description 扩展属性
708
+ */
709
+ extension?: Record<string, any>;
710
+ /**
711
+ * @description 元素属性
712
+ */
713
+ property: {
714
+ /**
715
+ * @description 文本宽度
716
+ */
717
+ width: number;
718
+ /**
719
+ * @description 文本高度
720
+ */
721
+ height?: number;
722
+ /**
723
+ * @description 元素位置
724
+ */
725
+ position: [number, number];
726
+ /**
727
+ * @description 元素旋转 z | [x, y, z]
728
+ */
729
+ rotation?: number | [number, number, number];
730
+ /**
731
+ * @description 元素缩放
732
+ */
733
+ scale?: [number, number];
734
+ /**
735
+ * @description 单行高度
736
+ */
737
+ lineHeight: number;
738
+ /**
739
+ * @description 字体名称
740
+ */
741
+ fontFamily: string;
742
+ /**
743
+ * @description 文字大小
744
+ */
745
+ fontSize: number;
746
+ /**
747
+ * @description 字重
748
+ */
749
+ fontWeight?: spec.TextWeight;
750
+ /**
751
+ * @description 字体格式
752
+ */
753
+ fontStyle?: spec.FontStyle;
754
+ /**
755
+ * @description 对齐方式
756
+ */
757
+ textAlign?: spec.TextAlignment;
758
+ /**
759
+ * @description 文本信息
760
+ */
761
+ text: string;
762
+ /**
763
+ * @description 填充色
764
+ */
765
+ color: spec.vec4;
766
+ /**
767
+ * @description 描边色
768
+ */
769
+ outlineColor?: spec.vec4;
770
+ /**
771
+ * @description 描边宽度
772
+ */
773
+ outlineWidth?: number;
774
+ /**
775
+ * @description 描边开关
776
+ */
777
+ outlineEnabled?: boolean;
778
+ /**
779
+ * @description 字体文件地址
780
+ */
781
+ fontUrl?: string;
782
+ /**
783
+ * @description 文本字间距
784
+ */
785
+ letterSpacing?: number;
786
+ };
787
+ };
788
+ /**
789
+ * @description 视频创建信息
790
+ */
791
+ export type VideoCreateInfo = {
792
+ type: SDKItemType.VIDEO;
793
+ /**
794
+ * @description 视频名称
795
+ */
796
+ name?: string;
797
+ /**
798
+ * @description 元素id
799
+ */
800
+ id?: string;
801
+ /**
802
+ * @description 父节点id
803
+ */
804
+ parentId?: string;
805
+ /**
806
+ * @description 扩展属性
807
+ */
808
+ extension?: Record<string, any>;
809
+ /**
810
+ * @description 元素属性
811
+ */
812
+ property: {
813
+ /**
814
+ * @description 视频资源地址 | 数据
815
+ */
816
+ video?: string;
817
+ /**
818
+ * @description 视频元素像素宽度
819
+ */
820
+ width: number;
821
+ /**
822
+ * @description 视频元素像素高度
823
+ */
824
+ height: number;
825
+ /**
826
+ * @description 视频元素位置
827
+ */
828
+ position: [number, number];
829
+ /**
830
+ * @description 视频元素旋转 z | [x, y, z]
831
+ */
832
+ rotation?: number | [number, number, number];
833
+ /**
834
+ * @description 视频元素缩放
835
+ */
836
+ scale?: [number, number];
837
+ /**
838
+ * @description 是否静音
839
+ */
840
+ muted?: boolean;
841
+ /**
842
+ * @description 是否为透明视频
843
+ */
844
+ transparent?: boolean;
845
+ /**
846
+ * @description 播放速率
847
+ */
848
+ playbackRate?: number;
849
+ /**
850
+ * @description 音量
851
+ */
852
+ volume?: number;
853
+ };
854
+ };
855
+ /**
856
+ * @description 卡片元素变换信息(视口坐标系)
857
+ */
858
+ export type CardItemTransformInfo = {
859
+ /** 卡片元素 ID */
860
+ id: string;
861
+ /** 卡片元素名称 */
862
+ name: string;
863
+ /** 卡片类型 */
864
+ cardType: string;
865
+ /** 视口坐标系中的左上角位置 [x, y] */
866
+ position: [number, number];
867
+ /** 视口坐标系中的宽高 [width, height] */
868
+ size: [number, number];
869
+ };
870
+ /**
871
+ * @description 卡片类型(动态配置,需在 SDK.config.itemConfig.cardConfig.cardTypes 中注册)
872
+ */
873
+ export type CardType = string;
874
+ /**
875
+ * @description 卡片创建信息
876
+ */
877
+ export type CardCreateInfo = {
878
+ /**
879
+ * @description 元素类型 - 卡片
880
+ */
881
+ type: SDKItemType.CARD;
882
+ /**
883
+ * @description 元素名称
884
+ */
885
+ name?: string;
886
+ /**
887
+ * @description 元素id
888
+ */
889
+ id?: string;
890
+ /**
891
+ * @description 父元素id
892
+ */
893
+ parentId?: string;
894
+ /**
895
+ * @description 扩展属性
896
+ */
897
+ extension?: Record<string, any>;
898
+ /**
899
+ * @description 元素属性
900
+ */
901
+ property: {
902
+ /**
903
+ * @description 卡片类型
904
+ */
905
+ cardType: CardType;
906
+ /**
907
+ * @description 卡片元素像素宽度
908
+ */
909
+ width: number;
910
+ /**
911
+ * @description 卡片元素像素高度
912
+ */
913
+ height: number;
914
+ /**
915
+ * @description 卡片元素位置
916
+ */
917
+ position: [number, number];
918
+ /**
919
+ * @description 卡片元素旋转 z | [x, y, z]
920
+ */
921
+ rotation?: number | [number, number, number];
922
+ /**
923
+ * @description 卡片元素缩放
924
+ */
925
+ scale?: [number, number];
926
+ /**
927
+ * @description HTML 覆盖层内容;存在该字段时由 DOM overlay 渲染
928
+ */
929
+ htmlContent?: CardHTMLContent;
930
+ };
931
+ };
932
+ /**
933
+ * @description 生成器类型
934
+ */
935
+ export type GeneratorType = 'image' | 'video';
936
+ /**
937
+ * @description 生成器创建信息
938
+ */
939
+ export type GeneratorCreateInfo = {
940
+ /**
941
+ * @description 元素类型 - 生成器
942
+ */
943
+ type: SDKItemType.GENERATOR;
944
+ /**
945
+ * @description 元素名称
946
+ */
947
+ name?: string;
948
+ /**
949
+ * @description 元素id
950
+ */
951
+ id?: string;
952
+ /**
953
+ * @description 父元素id
954
+ */
955
+ parentId?: string;
956
+ /**
957
+ * @description 扩展属性
958
+ */
959
+ extension?: Record<string, any>;
960
+ /**
961
+ * @description 元素属性
962
+ */
963
+ property: {
964
+ /**
965
+ * @description 生成器类型
966
+ */
967
+ generatorType: GeneratorType;
968
+ /**
969
+ * @description 生成器元素像素宽度
970
+ */
971
+ width: number;
972
+ /**
973
+ * @description 生成器元素像素高度
974
+ */
975
+ height: number;
976
+ /**
977
+ * @description 生成器元素位置
978
+ */
979
+ position: [number, number];
980
+ /**
981
+ * @description 生成器元素旋转 z | [x, y, z]
982
+ */
983
+ rotation?: number | [number, number, number];
984
+ /**
985
+ * @description 生成器元素缩放
986
+ */
987
+ scale?: [number, number];
988
+ };
989
+ };
990
+ /**
991
+ * @description 图片生成器资源信息
992
+ */
993
+ export type SpriteGeneratorResource = {
994
+ /**
995
+ * @description 资源地址
996
+ */
997
+ url: string;
998
+ /**
999
+ * @description 资源尺寸
1000
+ */
1001
+ size?: spec.vec2;
1002
+ /**
1003
+ * @description 目标生成器元素 ID(必填)
1004
+ */
1005
+ itemId: string;
1006
+ /**
1007
+ * @description 扩展属性
1008
+ */
1009
+ extension?: Record<string, any>;
1010
+ };
1011
+ /**
1012
+ * @description 视频生成器资源信息
1013
+ */
1014
+ export type VideoGeneratorResource = {
1015
+ /**
1016
+ * @description 资源地址
1017
+ */
1018
+ url: string;
1019
+ /**
1020
+ * @description 资源尺寸
1021
+ */
1022
+ size?: spec.vec2;
1023
+ /**
1024
+ * @description 是否静音(仅用于视频)
1025
+ */
1026
+ muted?: boolean;
1027
+ /**
1028
+ * @description 是否为透明视频(仅用于视频)
1029
+ */
1030
+ transparent?: boolean;
1031
+ /**
1032
+ * @description 播放速率(仅用于视频)
1033
+ */
1034
+ playbackRate?: number;
1035
+ /**
1036
+ * @description 音量(仅用于视频)
1037
+ */
1038
+ volume?: number;
1039
+ /**
1040
+ * @description 目标生成器元素 ID(必填)
1041
+ */
1042
+ itemId: string;
1043
+ /**
1044
+ * @description 扩展属性
1045
+ */
1046
+ extension?: Record<string, any>;
1047
+ };
1048
+ export type GeneratorResource = SpriteGeneratorResource | VideoGeneratorResource;
1049
+ /**
1050
+ * @description 生成器样式配置
1051
+ */
1052
+ export type GeneratorStyleConfig = {
1053
+ /**
1054
+ * @description 填充颜色 [r, g, b, a],范围 0-1
1055
+ */
1056
+ fillColor?: spec.vec4;
1057
+ /**
1058
+ * @description 图标 URL
1059
+ */
1060
+ iconUrl?: string;
1061
+ };
1062
+ export type EffectsCreateInfo = {
1063
+ /**
1064
+ * @description 元素类型 - 特效
1065
+ */
1066
+ type: SDKItemType.EFFECTS;
1067
+ /**
1068
+ * @description 元素名称
1069
+ */
1070
+ name?: string;
1071
+ /**
1072
+ * @description 元素id
1073
+ */
1074
+ id?: string;
1075
+ /**
1076
+ * @description 父元素id
1077
+ */
1078
+ parentId?: string;
1079
+ property: {
1080
+ /**
1081
+ * @description 动效像素宽度
1082
+ */
1083
+ width?: number;
1084
+ /**
1085
+ * @description 动效像素高度
1086
+ */
1087
+ height?: number;
1088
+ /**
1089
+ * @description 生成器位置
1090
+ */
1091
+ position: spec.vec2;
1092
+ /**
1093
+ * @description 旋转角度
1094
+ */
1095
+ rotation?: number | [number, number, number];
1096
+ /**
1097
+ * @description 缩放
1098
+ */
1099
+ scale?: spec.vec2;
1100
+ /**
1101
+ * @description 动效资源地址
1102
+ */
1103
+ effects: string;
1104
+ };
1105
+ /**
1106
+ * @description 扩展属性
1107
+ */
1108
+ extension?: Record<string, any>;
1109
+ };
1110
+ export type AsyncSpriteCreateInfo = SpriteCreateInfo & {
1111
+ textureId: string;
1112
+ };
1113
+ export type AsyncVideoCreateInfo = VideoCreateInfo & {
1114
+ textureId: string;
1115
+ };
1116
+ /**
1117
+ * @description Frame 画板元素创建信息
1118
+ */
1119
+ export type FrameCreateInfo = {
1120
+ /**
1121
+ * @description 元素类型 - 画板
1122
+ */
1123
+ type: SDKItemType.FRAME;
1124
+ /**
1125
+ * @description 元素名称
1126
+ */
1127
+ name?: string;
1128
+ /**
1129
+ * @description 元素id
1130
+ */
1131
+ id?: string;
1132
+ /**
1133
+ * @description 父元素id
1134
+ */
1135
+ parentId?: string;
1136
+ /**
1137
+ * @description 元素属性
1138
+ */
1139
+ property: {
1140
+ /**
1141
+ * @description 画板像素宽度
1142
+ */
1143
+ width: number;
1144
+ /**
1145
+ * @description 画板像素高度
1146
+ */
1147
+ height: number;
1148
+ /**
1149
+ * @description 画板位置
1150
+ */
1151
+ position: [number, number];
1152
+ /**
1153
+ * @description 画板旋转 z | [x, y, z]
1154
+ */
1155
+ rotation?: number | [number, number, number];
1156
+ /**
1157
+ * @description 画板缩放
1158
+ */
1159
+ scale?: [number, number];
1160
+ /**
1161
+ * @description 布局模式: 'auto' | 'free'
1162
+ */
1163
+ layoutMode?: FrameLayoutMode;
1164
+ /**
1165
+ * @description 子元素序号
1166
+ */
1167
+ children: string[];
1168
+ /**
1169
+ * @description 自动布局配置
1170
+ */
1171
+ autoLayoutConfig?: AutoLayoutConfig;
1172
+ /**
1173
+ * @description 子元素布局位置信息(用于自动布局)
1174
+ * key: 子元素ID, value: 元素的位置信息
1175
+ */
1176
+ layoutInfos?: Record<string, LayoutInfo>;
1177
+ };
1178
+ /**
1179
+ * @description 扩展属性
1180
+ */
1181
+ extension?: Record<string, any>;
1182
+ };
1183
+ export type ItemCreateInfo = GroupCreateInfo | SpriteCreateInfo | TextCreateInfo | VideoCreateInfo | GeneratorCreateInfo | EffectsCreateInfo | FrameCreateInfo | CardCreateInfo;
1184
+ export type AsyncItemCreateInfo = GroupCreateInfo | TextCreateInfo | AsyncSpriteCreateInfo | AsyncVideoCreateInfo;
1185
+ /**
1186
+ * @description 场景创建信息
1187
+ */
1188
+ export type SceneCreaetInfo = {
1189
+ /**
1190
+ * @description 场景名称
1191
+ */
1192
+ name: string;
1193
+ /**
1194
+ * @description 场景大小
1195
+ */
1196
+ size: spec.vec2;
1197
+ };
1198
+ export declare enum ItemOrderAction {
1199
+ BringToFront = 0,
1200
+ SendToBack = 1,
1201
+ BringForward = 2,
1202
+ SendBackward = 3
1203
+ }
1204
+ /**
1205
+ * @description 视图自适应偏移参数
1206
+ */
1207
+ export type ViewportFitShiftParam = {
1208
+ /**
1209
+ * @description 左偏移
1210
+ */
1211
+ left?: number;
1212
+ /**
1213
+ * @description 右偏移
1214
+ */
1215
+ right?: number;
1216
+ /**
1217
+ * @description 上偏移
1218
+ */
1219
+ top?: number;
1220
+ /**
1221
+ * @description 下偏移
1222
+ */
1223
+ bottom?: number;
1224
+ };
1225
+ export type TextureInfo = {
1226
+ id: string;
1227
+ url: string;
1228
+ type: 'image' | 'video';
1229
+ };
1230
+ export type LoadTextureInfo = {
1231
+ id: string;
1232
+ textureId: string;
1233
+ url: string;
1234
+ type: 'image' | 'video';
1235
+ };