@vvfx/sdk 0.1.19-alpha.36 → 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,370 @@
1
+ import { SDK, SDKEvents } from '../sdk';
2
+ import type { Player, EventEmitter, Composition } from '../shared';
3
+ import { VFXItem } from '../shared';
4
+ import type { SetItemPropertyParam, SpriteCreateInfo, GroupCreateInfo, TextCreateInfo, ViewportFitShiftParam, ItemCreateInfo, VideoCreateInfo, AsyncSpriteCreateInfo, AsyncVideoCreateInfo, GeneratorCreateInfo, EffectsCreateInfo, FrameCreateInfo, PageAutoLayoutParam, CardCreateInfo } from '../types';
5
+ import type { SDKItem } from '../sdk-item';
6
+ import { ItemOrderAction } from '../types';
7
+ import { InteractionUtils } from './interaction-utils';
8
+ import { spec } from '../shared';
9
+ import { Box2, Matrix4, Vector2, Vector3 } from '../math';
10
+ import { MoveItemTransformOptions } from './json-data-utils';
11
+ import { AlignType, DistributeType } from './types';
12
+ import { SDKItemType } from '../sdk-item/types';
13
+ export declare class PageDataUtils {
14
+ private sdk;
15
+ player: Player;
16
+ container: HTMLElement;
17
+ emitter: EventEmitter<SDKEvents>;
18
+ interactionUtils: InteractionUtils;
19
+ constructor(player: Player, container: HTMLElement, emitter: EventEmitter<SDKEvents>, sdk: SDK);
20
+ init(): void;
21
+ getPageData(): import("..").PageData | undefined;
22
+ getCurrentComposition(): Composition;
23
+ isItemSelected(id: string): boolean;
24
+ getItemEditEnable(id: string): boolean;
25
+ getItemShow(id: string): boolean;
26
+ addSelectedItems(ids: string[]): void;
27
+ removeSelectedItems(ids: string[]): void;
28
+ clearSelectedItems(emitChange?: boolean): void;
29
+ getSelectedItems(): SDKItem[];
30
+ addPreSelectedItem(id: string): void;
31
+ clearPreSelectedItem(): void;
32
+ getPreSelectedItem(): SDKItem | undefined;
33
+ addLoadingItems(ids: string[]): void;
34
+ removeLoadingItems(ids: string[]): void;
35
+ clearLoadingItems(): void;
36
+ getLoadingItems(): SDKItem[];
37
+ getSDKItem(id: string): SDKItem | undefined;
38
+ getPlayerSizeByParent(parentSize: [number, number], sceneSize: [number, number]): readonly [number, number];
39
+ loadScene(id: number): Promise<void>;
40
+ refreshPageTime(number: number): void;
41
+ pageZoom(shift: number, center?: Vector2, ignoreClamp?: boolean): void;
42
+ setPageZoom(targetZoom: number, center?: Vector2, ignoreClamp?: boolean): void;
43
+ refreshInteractionParam(): void;
44
+ pageMove(shift: Vector2): void;
45
+ setPageMove(targetTranslation: Vector2): void;
46
+ /**
47
+ * @description 设置当前相机视图矩阵
48
+ * @param matrix 视图矩阵
49
+ */
50
+ setCurrenCameraViewportMatrix(matrix: Matrix4): void;
51
+ rotateItem(id: string, shift: Vector3, ignoreEvent?: boolean): void;
52
+ moveItem(id: string, shift: Vector3, ignoreEvent?: boolean): void;
53
+ scaleItem(id: string, shift: Vector3, ignoreEvent?: boolean): void;
54
+ /**
55
+ * @description 触发卡片元素变换事件,返回视口坐标系中的位置与大小
56
+ * @param ids 指定卡片元素 ID(不传则返回所有卡片元素)
57
+ */
58
+ private emitCardItemTransformChange;
59
+ scaleTextItemWidth(id: string, scalar: number): void;
60
+ scaleTextItem(id: string, scalar: number): void;
61
+ getItemTransformById(id: string): {
62
+ matrix: Matrix4;
63
+ parentMatrix: Matrix4;
64
+ };
65
+ addSDKItemsByItems(result: SDKItem[], playerItems: VFXItem[], id?: string): void;
66
+ getFilterItemIds(): (string | undefined)[];
67
+ createSDKItemByPlayerItem(playerItem: VFXItem, parentId?: string): SDKItem;
68
+ /**
69
+ * @description 根据 spec.ItemType 创建 SDKItem(内部辅助方法)
70
+ * @param itemType spec.ItemType
71
+ * @param baseOptions 基础选项
72
+ * @param property 属性
73
+ * @returns SDKItem 实例
74
+ */
75
+ private createSDKItemBySpecType;
76
+ getViewBoxById(id: string): Box2;
77
+ getItemViewAnchor(id: string): Vector2 | undefined;
78
+ getChildrenPlayerItems(item?: VFXItem): VFXItem[];
79
+ getChildrenSceneItemIds(id: string, scene: spec.JSONScene): string[];
80
+ getViewBoxByPlayerItem(item: VFXItem, childrenItem: VFXItem[]): Box2;
81
+ getViewportLeftTopPosition(): Vector2;
82
+ getViewportByViewPoint(point: Vector2): Vector2;
83
+ /**
84
+ * @description 设置元素属性(支持单个元素的单/多属性设置)
85
+ * @param param 设置参数,支持两种场景:
86
+ * 1. 单个元素单个属性: { itemId, type, propertyName, propertyValue }
87
+ * 2. 单个元素多个属性: { itemId, type, property }
88
+ */
89
+ setItemProperty<T extends SDKItemType>(param: SetItemPropertyParam<T>): Promise<void>;
90
+ /**
91
+ * @description 场景 1: 设置单个元素的单个属性
92
+ */
93
+ private setSingleItemSingleProperty;
94
+ /**
95
+ * @description 场景 2: 设置单个元素的多个属性
96
+ */
97
+ private setSingleItemMultipleProperties;
98
+ /**
99
+ * @description 更新 PlayerItem 的属性
100
+ * @param itemId 元素ID
101
+ * @param propertyName 属性名
102
+ * @param propertyValue 属性值
103
+ */
104
+ private updatePlayerItemProperty;
105
+ /**
106
+ * @description 更新 PlayerItem 的基础属性
107
+ */
108
+ private updatePlayerItemBaseProperty;
109
+ /**
110
+ * @description 更新 PlayerItem 的 Property 属性
111
+ */
112
+ private updatePlayerItemPropertyAttribute;
113
+ /**
114
+ * @description 更新 JSON Scene 中 Item 的属性
115
+ * @param itemId 元素ID
116
+ * @param propertyName 属性名
117
+ * @param propertyValue 属性值
118
+ */
119
+ private updateJSONItemProperty;
120
+ /**
121
+ * @description 更新 Scene 中 Item 的基础属性
122
+ */
123
+ private updateSceneItemBaseProperty;
124
+ /**
125
+ * @description 更新 Scene 中 Item 的 Property 属性
126
+ */
127
+ updateSceneItemPropertyAttribute(scene: spec.JSONScene, itemId: string, propertyName: string, propertyValue: any): void;
128
+ setSpriteSize(id: string, size: [number, number]): void;
129
+ transformSceneItem(id: string, property: 'position' | 'rotation' | 'scale', shift: [number, number, number]): void;
130
+ refreshSDKItem(id: string): void;
131
+ /**
132
+ * @description 更新已有 SDKItem 的属性(而不是替换整个对象)
133
+ * @param sdkItem 需要更新的 SDKItem
134
+ * @param playerItem 对应的 Player VFXItem
135
+ */
136
+ updateSDKItemFromPlayerItem(sdkItem: SDKItem, playerItem: VFXItem): void;
137
+ getPlayerItemById(id?: string): VFXItem | undefined;
138
+ getPixelSizeByWorldSize(worldSize: spec.vec3, item: VFXItem): spec.vec2;
139
+ getWorldSizeByPixelSize(pixelSize: spec.vec2): spec.vec2;
140
+ /**
141
+ * @private
142
+ * @description 获取当前激活的场景
143
+ */
144
+ private getActiveTargetScene;
145
+ /**
146
+ * @description 获取场景主合成的 previewSize
147
+ * @param scene 可选,未传时取当前激活视图场景
148
+ * @returns 主合成的 previewSize;场景/主合成/previewSize 任一不存在时返回 undefined
149
+ */
150
+ getSceneSize(scene?: spec.JSONScene): Vector2 | undefined;
151
+ /**
152
+ * @private
153
+ * @description 刷新场景和页面数据
154
+ */
155
+ private refreshSceneAndPageData;
156
+ addSpriteItem(spriteInfo: AsyncSpriteCreateInfo, asyncMode: true, targetScene?: spec.JSONScene): Promise<string>;
157
+ addSpriteItem(spriteInfo: SpriteCreateInfo, asyncMode: false, targetScene?: spec.JSONScene): Promise<string>;
158
+ /**
159
+ * @description 添加卡片元素
160
+ * @description 底层以透明 SpriteItem 形式渲染,不传 textureId
161
+ * @param cardInfo 卡片创建信息
162
+ * @param targetScene 目标场景(可选)
163
+ * @returns 元素 id
164
+ */
165
+ addCardItem(cardInfo: CardCreateInfo, targetScene?: spec.JSONScene): string | undefined;
166
+ addGroupItem(groupInfo: GroupCreateInfo, targetScene?: spec.JSONScene): string | undefined;
167
+ addTextItem(textInfo: TextCreateInfo, targetScene?: spec.JSONScene): Promise<string | undefined>;
168
+ addVideoItem(videoInfo: AsyncVideoCreateInfo, asyncMode: true, targetScene?: spec.JSONScene): Promise<string>;
169
+ addVideoItem(videoInfo: VideoCreateInfo, asyncMode: false, targetScene?: spec.JSONScene): Promise<string>;
170
+ /**
171
+ * @description 添加生成器元素
172
+ * @param createInfo 生成器创建信息
173
+ * @param targetScene 目标场景
174
+ * @returns 元素ID
175
+ */
176
+ addGeneratorItem(createInfo: GeneratorCreateInfo, targetScene?: spec.JSONScene): string;
177
+ /**
178
+ * @description 设置生成器资源,将生成器转换为对应的元素(SpriteItem 或 VideoItem)
179
+ * @param id 生成器元素ID
180
+ * @param resourceUrl 资源地址
181
+ * @returns 新的元素ID
182
+ */
183
+ setGeneratorResource(id: string, resourceUrl: string): Promise<string>;
184
+ /**
185
+ * @description 将视频生成器转换为视频元素
186
+ * @param id 视频生成器元素ID
187
+ * @param videoUrl 视频资源地址
188
+ * @returns 新的视频元素ID
189
+ * @deprecated 使用 setGeneratorResource 替代
190
+ */
191
+ convertVideoGeneratorToVideo(id: string, videoUrl: string): Promise<string>;
192
+ /**
193
+ * @description 删除元素
194
+ * @param id 元素id
195
+ */
196
+ deleteItem(id: string): void;
197
+ /**
198
+ * @description 统一的元素认父函数,根据父节点类型自动选择处理逻辑
199
+ * @param itemId 子元素ID
200
+ * @param parentId 父元素ID
201
+ * @param targetScene 目标场景(可选,默认当前场景)
202
+ * @returns 是否认父成功
203
+ */
204
+ setItemParentUnified(itemId: string, parentId: string, targetScene?: spec.JSONScene): boolean;
205
+ /**
206
+ * @description 将元素设置到空节点/组下
207
+ * @param itemId 子元素ID
208
+ * @param parentId 父节点ID(必须是空节点/组)
209
+ * @param targetScene 目标场景
210
+ * @private
211
+ */
212
+ private setItemParentToGroup;
213
+ /**
214
+ */
215
+ setItemParent(id: string, parentId: string, targetScene?: spec.JSONScene): void;
216
+ deleteItemParent(id: string, parentId: string, targetScene?: spec.JSONScene): void;
217
+ /**
218
+ * @description 将元素移动到 Frame 中
219
+ * @param itemIds 要移动的元素ID列表
220
+ * @param frameId 目标 Frame ID
221
+ */
222
+ moveItemsToFrame(itemIds: string[], frameId: string): void;
223
+ /**
224
+ * @description 移动单个元素到 Frame(仅 JSON 层,Player 层在 reLoad 后重建)
225
+ * @private
226
+ */
227
+ private moveSingleJSONItemToFrame;
228
+ /**
229
+ * @description 移动单个元素到 Frame(保持 parentId)
230
+ * @param itemId 元素ID
231
+ * @param frameItem 目标 Frame
232
+ * @param options 变换选项
233
+ * @param mainScene 主场景
234
+ * @param parentId 要保持的父节点ID
235
+ * @private
236
+ */
237
+ private moveSingleJSONItemToFrameWithParent;
238
+ /**
239
+ * @description 收集元素及其所有子元素(递归处理嵌套组)
240
+ * @param itemIds 初始元素ID列表
241
+ * @returns 包含所有子元素的ID列表
242
+ * @private
243
+ */
244
+ private collectItemsWithChildren;
245
+ private moveSinglePlayerItemToFrame;
246
+ /**
247
+ * @description 将元素从 Frame 中移出到主场景
248
+ * @param itemIds 要移动的元素ID列表
249
+ * @param frameId 源 Frame ID(可选,如果不传则从第一个元素的 parentId 推断)
250
+ */
251
+ moveItemsOutOfFrame(itemIds: string[]): void;
252
+ /**
253
+ * @description 移动单个元素从 Frame 到主场景(仅 JSON 层)
254
+ * @private
255
+ */
256
+ private moveSingleJSONItemOutOfFrame;
257
+ private moveSinglePlayerItemOutOfFrame;
258
+ setItemName(id: string, name: string, targetScene?: spec.JSONScene): void;
259
+ get undoRedo(): import("../service/UndoRedo").UndoRedo;
260
+ saveUndoRedoOldData(): void;
261
+ pushUndoRedoData(): void;
262
+ getItemCreateInfo(id: string, withParent?: boolean): GroupCreateInfo | SpriteCreateInfo | TextCreateInfo | VideoCreateInfo | GeneratorCreateInfo | EffectsCreateInfo | FrameCreateInfo | CardCreateInfo | undefined;
263
+ getChildrenIds(id: string): string[];
264
+ createScreenShotSceneByIds(idInfo: string | string[]): any;
265
+ createSceneByCreateInfos(createInfos: ItemCreateInfo[], sceneSize?: spec.vec2, name?: string, scenePosition?: spec.vec2): spec.JSONScene;
266
+ /**
267
+ * @description 更新元素在图片中的顺序(仅在同级元素之间)
268
+ * @param id 元素ID
269
+ * @param action 排序操作类型
270
+ */
271
+ updateItemOrder(id: string, action: ItemOrderAction): void;
272
+ private isPluginItem;
273
+ private refreshItemRenderOrder;
274
+ /**
275
+ * @description 根据 composition.items 的顺序重新排列 pageData.items
276
+ * @param composition 当前场景
277
+ */
278
+ private syncPageDataItemsOrder;
279
+ getViewProperty(id?: number): import("..").ViewProperty | undefined;
280
+ viewportFit(shiftParam?: ViewportFitShiftParam, box?: Box2): void;
281
+ getItemBoxById(idInfo: string): Box2;
282
+ getItemBoxById(idInfo: string[]): Box2[];
283
+ setItemFontFamily(id: string, fontFamilyName: string, url: string): Promise<void>;
284
+ changeItemPropertyByCreateInfo(itemCreateInfo: ItemCreateInfo | ItemCreateInfo[]): Promise<void>;
285
+ getViewBoxByBox(box: Box2): Box2;
286
+ playVideoItem(id?: string): void;
287
+ pauseVideoItem(id?: string): void;
288
+ playEffectsItem(id?: string): void;
289
+ pauseEffectsItem(id?: string): void;
290
+ setEffectsResource(id: string, effects: string): void;
291
+ /**
292
+ * @description 根据元素创建信息获取包围盒
293
+ * @param createInfo 元素创建信息
294
+ * @returns 包围盒
295
+ */
296
+ getBoundingBoxByCreateInfo(createInfo: ItemCreateInfo): Box2;
297
+ /**
298
+ * @description 根据元素创建信息组获取包围盒
299
+ * @param createInfos 元素创建信息组
300
+ * @returns 包围盒
301
+ */
302
+ getBoundingBoxByCreateInfos(createInfos: ItemCreateInfo[]): Box2;
303
+ getVideoItemPlayTime(id: string): number;
304
+ setVideoItemPlayTime(id: string, time: number): void;
305
+ getEffectsItemPlayTime(id: string): number | undefined;
306
+ setEffectsItemPlayTime(id: string, time: number): void;
307
+ getPixelPositionByViewPosition(viewPosition: Vector2): Vector2;
308
+ getItemParentScale(id: string): Vector3;
309
+ getJSONItem(id: string): spec.VFXItemData | undefined;
310
+ getJSONComponent(id: string): spec.ComponentData | undefined;
311
+ getTextOriginSize(id: string): {
312
+ size: spec.vec2;
313
+ isPublishScene: boolean;
314
+ };
315
+ asyncAddItemByCreateInfos(createInfos: ItemCreateInfo[]): Promise<string[]>;
316
+ addItemByCreateInfos(createInfos: ItemCreateInfo[]): Promise<string[]>;
317
+ addEffectsItem(createInfo: EffectsCreateInfo, targetScene?: spec.JSONScene): Promise<string | undefined>;
318
+ /**
319
+ * @description 添加画板元素
320
+ * @param createInfo 画板创建信息
321
+ * @param targetScene 目标场景
322
+ * @returns 元素ID
323
+ */
324
+ addFrameItem(createInfo: FrameCreateInfo, targetScene?: spec.JSONScene): Promise<string>;
325
+ makeItemAlign(type: AlignType, ids?: string[]): void;
326
+ makeItemDistribute(type: DistributeType, ids?: string[]): void;
327
+ setItemLockState(id: string, state: boolean): void;
328
+ getItemLockState(id: string): boolean;
329
+ /**
330
+ * @description 计算元素在新父节点下保持世界绝对 transform 不变时所需的局部 transform
331
+ * @param itemId 要移动的元素 ID
332
+ * @param targetParentVFXItem 目标父 VFXItem(移入 Frame 时为 compositionItem,移出 Frame 时为 composition.rootItem)
333
+ */
334
+ getItemTransformUnderParent(itemId: string, targetParentVFXItem: VFXItem): MoveItemTransformOptions | undefined;
335
+ /**
336
+ * @description 修改画板元素大小
337
+ * @param id 元素id
338
+ * @param size 目标大小 [width, height]
339
+ * @param translation 位置偏移补偿(可选,用于保持拖拽角点固定)
340
+ */
341
+ resizeFrameItem(id: string, size: spec.vec2, translation?: Vector3): void;
342
+ /**
343
+ * @description 对 FrameItem 执行自动布局(Shelf 算法)
344
+ * @param frameId Frame 元素 ID
345
+ */
346
+ applyFrameAutoLayout(frameId: string): void;
347
+ /**
348
+ * @description 将 layout-utils 的 AutoLayoutResult 结果记录到 layoutInfos
349
+ * @param frameId Frame 元素 ID
350
+ * @param layoutResult autoLayout 函数返回的结果
351
+ */
352
+ private recordLayoutInfosFromAutoLayoutResult;
353
+ /**
354
+ * @description 刷新画板子元素
355
+ * @param id 画板元素id
356
+ */
357
+ refreshFrameChildren(id: string): void;
358
+ autoLayoutPage(param?: PageAutoLayoutParam): Promise<void>;
359
+ /**
360
+ * @description 计算选中元素排布的锚点偏移:保持原始包围盒左上角位置不变
361
+ * @param layoutElements 参与排布的元素列表
362
+ * @param layoutBoundingBox 排布算法输出的包围盒
363
+ */
364
+ private getPartialLayoutAnchor;
365
+ /**
366
+ * @description 计算全量排布的锚点偏移:以视口中心为锚点
367
+ * @param layoutBoundingBox 排布算法输出的包围盒
368
+ */
369
+ private getGlobalLayoutAnchor;
370
+ }
@@ -0,0 +1,11 @@
1
+ import { Composition, VFXItem, Constructor, Component, spec } from '@galacean/effects';
2
+ export declare class DefaultVFXItems {
3
+ static createEmpty(composition: Composition, parent?: null, name?: string): VFXItem;
4
+ static createSprite(composition: Composition, parent?: null, name?: string): VFXItem;
5
+ static createText(composition: Composition, parent?: null, name?: string): VFXItem;
6
+ static createVideo(composition: Composition, parent?: null, name?: string): VFXItem;
7
+ static createEffects(composition: Composition, effects: string | spec.JSONScene, parent?: null, urlname?: string): Promise<VFXItem>;
8
+ }
9
+ export declare class VFXItemFactory {
10
+ static createVFXItem(composition: Composition, parent?: null, name?: string, ...types: Constructor<Component>[]): VFXItem;
11
+ }
@@ -0,0 +1,114 @@
1
+ import type { Matrix4, Vector2, Vector3 } from '../math';
2
+ import { spec } from '../shared';
3
+ /**
4
+ * @description 交互状态视图信息
5
+ */
6
+ export type ViewInteractionParam = {
7
+ /**
8
+ * @description 视口宽度 - 红框区域像素大小
9
+ */
10
+ width: number;
11
+ /**
12
+ * @description 视口高度 - 红框区域像素大小
13
+ */
14
+ height: number;
15
+ /**
16
+ * @description 视口缩放比例
17
+ */
18
+ scale: number;
19
+ /**
20
+ * @description 视口位移信息
21
+ */
22
+ translation: Vector2;
23
+ /**
24
+ * @description 标尺宽度
25
+ */
26
+ rulerWidth: number;
27
+ };
28
+ /**
29
+ * @description 交互状态相机信息
30
+ */
31
+ export type CameraInteractionParam = {
32
+ /**
33
+ * @description 位置
34
+ */
35
+ position: Vector3;
36
+ /**
37
+ * @description 旋转角度
38
+ */
39
+ rotation: Vector3;
40
+ /**
41
+ * @description 视野初始中心
42
+ */
43
+ focusPosition: Vector3;
44
+ /**
45
+ * @description 视野初始角度
46
+ */
47
+ focusRotation: Vector3;
48
+ /**
49
+ * @description 投影矩阵
50
+ */
51
+ viewProjectionMatrix: Matrix4;
52
+ /**
53
+ * @description 逆投影矩阵
54
+ */
55
+ inverseViewProjectionMatrix: Matrix4;
56
+ };
57
+ export declare const SafeConstraint: {
58
+ topAdsorption: string;
59
+ leftAdsorption: string;
60
+ rightAdsorption: string;
61
+ bottomAdsorption: string;
62
+ centerAdsorption: string;
63
+ bottomCenterAdsorption: string;
64
+ };
65
+ export type ItemJSONInfo = {
66
+ item: spec.VFXItemData;
67
+ components: spec.ComponentData[];
68
+ tracks: any[];
69
+ playableAssets: any[];
70
+ };
71
+ export type AlignType = 'left' | 'right' | 'horizontal-center' | 'top' | 'bottom' | 'vertical-center';
72
+ export type DistributeType = 'vertical-spacing' | 'horizontal-spacing';
73
+ /**
74
+ * @description 背景类型预设配置
75
+ */
76
+ export type BackgroundPreset = {
77
+ /**
78
+ * @description 背景颜色
79
+ */
80
+ color?: string;
81
+ /**
82
+ * @description 背景图片/渐变
83
+ */
84
+ image?: string;
85
+ /**
86
+ * @description 背景重复方式
87
+ */
88
+ repeat?: string;
89
+ /**
90
+ * @description 背景位置
91
+ */
92
+ position?: string;
93
+ /**
94
+ * @description 背景大小
95
+ */
96
+ size?: string;
97
+ };
98
+ /**
99
+ * @description 背景网格配置
100
+ */
101
+ export type BackgroundGridConfig = {
102
+ /**
103
+ * @description 基础网格大小(像素)
104
+ */
105
+ baseSize: number;
106
+ /**
107
+ * @description 缩放循环阈值(默认 2,即 2x 时重置)
108
+ */
109
+ zoomCycle: number;
110
+ /**
111
+ * @description 最小网格大小限制
112
+ */
113
+ minSize: number;
114
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { Line2 } from '../../math';
2
+ import type { Box2 } from '../../math/box2';
3
+ import { type Point } from './pixi';
4
+ declare module '@pixi/graphics' {
5
+ interface Graphics {
6
+ fillBox(box: Box2): void;
7
+ drawBox(box: Box2): void;
8
+ drawLine(line: Line2 | Point[]): void;
9
+ drawDashLine(toX: number, toY: number, dash: number, gap: number): void;
10
+ }
11
+ }
@@ -0,0 +1,18 @@
1
+ import '@pixi/polyfill';
2
+ import * as utils from '@pixi/utils';
3
+ import { Application } from '@pixi/app';
4
+ import type { IApplicationOptions, IApplicationPlugin } from '@pixi/app';
5
+ export * from '@pixi/constants';
6
+ export * from '@pixi/core';
7
+ export * from '@pixi/display';
8
+ export * from '@pixi/graphics';
9
+ export * from '@pixi/loaders';
10
+ export * from '@pixi/interaction';
11
+ export * from '@pixi/math';
12
+ export * from '@pixi/runner';
13
+ export * from '@pixi/sprite';
14
+ export * from '@pixi/text';
15
+ export * from '@pixi/ticker';
16
+ export * from '@pixi/settings';
17
+ export { utils, Application };
18
+ export type { IApplicationOptions, IApplicationPlugin };
@@ -0,0 +1,4 @@
1
+ export * from './common/box';
2
+ export * from './common/line';
3
+ export * from './common/dashed-line';
4
+ export * from './common/pixi';
package/package.json CHANGED
@@ -1,38 +1,38 @@
1
1
  {
2
2
  "name": "@vvfx/sdk",
3
- "description": "VVFX 开放 SDK",
4
- "version": "0.1.19-alpha.36",
5
- "type": "module",
6
- "main": "./dist/index.cjs",
3
+ "description": "TODO",
4
+ "version": "0.1.19-alpha.38",
5
+ "main": "./dist/index.mjs",
7
6
  "module": "./dist/index.js",
8
7
  "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
9
11
  "exports": {
10
12
  ".": {
11
13
  "types": "./dist/index.d.ts",
12
14
  "import": "./dist/index.js",
13
- "require": "./dist/index.cjs"
15
+ "require": "./dist/index.mjs"
14
16
  }
15
17
  },
16
- "files": [
17
- "dist"
18
- ],
19
- "publishConfig": {
20
- "access": "public"
21
- },
22
18
  "scripts": {
23
- "build": "tsup",
24
- "dev": "tsup --watch",
25
- "check": "tsc -b ./tsconfig.json"
19
+ "prebuild": "pnpm clean",
20
+ "build": "pnpm build:declaration && pnpm build:module",
21
+ "build:module": "rollup -c --bundleConfigAsCjs",
22
+ "build:declaration": "tsc -d --emitDeclarationOnly",
23
+ "clean": "rimraf dist *.tsbuildinfo",
24
+ "test": "vitest run",
25
+ "prepublishOnly": "pnpm build"
26
26
  },
27
27
  "dependencies": {
28
28
  "@ffmpeg/ffmpeg": "0.12.15",
29
29
  "@ffmpeg/util": "0.12.2",
30
- "@galacean/effects": "^2.9.0-alpha.2",
31
- "@galacean/effects-plugin-rich-text": "^2.9.0-alpha.2",
32
- "@galacean/effects-plugin-model": "^2.9.0-alpha.2",
33
- "@galacean/effects-plugin-multimedia": "^2.9.0-alpha.2",
34
- "@galacean/effects-plugin-spine": "^2.9.0-alpha.2",
35
- "@galacean/effects-plugin-ffd": "^2.9.0-alpha.2",
30
+ "@galacean/effects": "^2.9.0",
31
+ "@galacean/effects-plugin-ffd": "2.9.0",
32
+ "@galacean/effects-plugin-model": "2.9.0",
33
+ "@galacean/effects-plugin-multimedia": "2.9.0",
34
+ "@galacean/effects-plugin-rich-text": "2.9.0",
35
+ "@galacean/effects-plugin-spine": "2.9.0",
36
36
  "@pixi/app": "^6.5.10",
37
37
  "@pixi/constants": "^6.5.10",
38
38
  "@pixi/core": "^6.5.10",
@@ -50,8 +50,26 @@
50
50
  "@pixi/text": "^6.5.10",
51
51
  "@pixi/ticker": "^6.5.10",
52
52
  "@pixi/utils": "^6.5.10",
53
- "jszip": "^3.10.1"
53
+ "@progress/jszip-esm": "^1.0.4"
54
54
  },
55
- "devDependencies": {},
56
- "repository": "git@code.alipay.com:vvfx/sdk.git"
55
+ "contributors": [
56
+ {
57
+ "name": "赤芍"
58
+ },
59
+ {
60
+ "name": "何即"
61
+ },
62
+ {
63
+ "name": "不择"
64
+ },
65
+ {
66
+ "name": "意绮"
67
+ }
68
+ ],
69
+ "author": "Ant Group CO., Ltd.",
70
+ "license": "MIT",
71
+ "publishConfig": {
72
+ "access": "public",
73
+ "registry": "https://registry.npmjs.org"
74
+ }
57
75
  }