@vvfx/sdk 0.1.19-alpha.9 → 0.2.1-alpha.0

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 (102) hide show
  1. package/LICENSE +22 -0
  2. package/dist/index.js +95856 -14
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.mjs +95958 -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/auto-height-runtime.d.ts +13 -0
  36. package/dist/src/html-overlay/document-runtime.d.ts +4 -0
  37. package/dist/src/html-overlay/document-transform.d.ts +7 -0
  38. package/dist/src/html-overlay/dom-order.d.ts +1 -0
  39. package/dist/src/html-overlay/host-message-runtime.d.ts +3 -0
  40. package/dist/src/html-overlay/html-viewport-style.d.ts +1 -0
  41. package/dist/src/html-overlay/index.d.ts +1 -0
  42. package/dist/src/html-overlay/manager.d.ts +77 -0
  43. package/dist/src/html-overlay/mime-utils.d.ts +2 -0
  44. package/dist/src/html-overlay/overlay-transform.d.ts +13 -0
  45. package/dist/src/html-overlay/path-utils.d.ts +8 -0
  46. package/dist/src/html-overlay/shell-runtime.d.ts +6 -0
  47. package/dist/src/index.d.ts +14 -0
  48. package/dist/src/math/box2.d.ts +166 -0
  49. package/dist/src/math/circle.d.ts +82 -0
  50. package/dist/src/math/euler.d.ts +20 -0
  51. package/dist/src/math/index.d.ts +13 -0
  52. package/dist/src/math/line2.d.ts +93 -0
  53. package/dist/src/math/line3.d.ts +17 -0
  54. package/dist/src/math/matrix4.d.ts +28 -0
  55. package/dist/src/math/plane.d.ts +14 -0
  56. package/dist/src/math/quaternion.d.ts +3 -0
  57. package/dist/src/math/ray-caster.d.ts +10 -0
  58. package/dist/src/math/ray.d.ts +18 -0
  59. package/dist/src/math/type.d.ts +32 -0
  60. package/dist/src/math/utils.d.ts +19 -0
  61. package/dist/src/math/vector2.d.ts +30 -0
  62. package/dist/src/math/vector3.d.ts +29 -0
  63. package/dist/src/screen-shot/index.d.ts +1 -0
  64. package/dist/src/screen-shot/screen-shot.d.ts +35 -0
  65. package/dist/src/sdk-item/base-item.d.ts +126 -0
  66. package/dist/src/sdk-item/card-item.d.ts +67 -0
  67. package/dist/src/sdk-item/effects-item.d.ts +70 -0
  68. package/dist/src/sdk-item/frame-item.d.ts +112 -0
  69. package/dist/src/sdk-item/generator-item.d.ts +86 -0
  70. package/dist/src/sdk-item/group-item.d.ts +57 -0
  71. package/dist/src/sdk-item/index.d.ts +36 -0
  72. package/dist/src/sdk-item/sprite-item.d.ts +67 -0
  73. package/dist/src/sdk-item/text-item.d.ts +107 -0
  74. package/dist/src/sdk-item/types.d.ts +153 -0
  75. package/dist/src/sdk-item/video-item.d.ts +87 -0
  76. package/dist/src/sdk.d.ts +589 -0
  77. package/dist/src/service/UndoRedo.d.ts +48 -0
  78. package/dist/src/shared/index.d.ts +1 -0
  79. package/dist/src/shared/player.d.ts +9 -0
  80. package/dist/src/size-adapte/index.d.ts +1 -0
  81. package/dist/src/size-adapte/size-adapt.d.ts +28 -0
  82. package/dist/src/types.d.ts +1298 -0
  83. package/dist/src/utils/background-manager.d.ts +72 -0
  84. package/dist/src/utils/common-utils.d.ts +28 -0
  85. package/dist/src/utils/index.d.ts +8 -0
  86. package/dist/src/utils/interaction-utils.d.ts +60 -0
  87. package/dist/src/utils/json-data-utils.d.ts +165 -0
  88. package/dist/src/utils/layout-utils.d.ts +219 -0
  89. package/dist/src/utils/page-data-utils.d.ts +372 -0
  90. package/dist/src/utils/player-data-utils.d.ts +11 -0
  91. package/dist/src/utils/types.d.ts +114 -0
  92. package/dist/src/wireframe/common/box.d.ts +1 -0
  93. package/dist/src/wireframe/common/dashed-line.d.ts +1 -0
  94. package/dist/src/wireframe/common/line.d.ts +1 -0
  95. package/dist/src/wireframe/common/pixi-ext.d.ts +11 -0
  96. package/dist/src/wireframe/common/pixi.d.ts +18 -0
  97. package/dist/src/wireframe/index.d.ts +4 -0
  98. package/package.json +42 -22
  99. package/dist/index.cjs +0 -14
  100. package/dist/index.d.cts +0 -3555
  101. package/dist/index.d.ts +0 -3555
  102. package/dist/index.global.js +0 -333
@@ -0,0 +1,18 @@
1
+ export declare const HELPER_CONFIG: {
2
+ WEBP: {
3
+ SCRIPT: string;
4
+ WASM: string;
5
+ };
6
+ FFMPEG: {
7
+ CLASSWORKER: string;
8
+ DEFAULT: {
9
+ CORE: string;
10
+ WASM: string;
11
+ };
12
+ MT: {
13
+ CORE: string;
14
+ WASM: string;
15
+ WORKER: string;
16
+ };
17
+ };
18
+ };
@@ -0,0 +1,71 @@
1
+ export declare const STATUS_MAP: {
2
+ readonly READY: "ready";
3
+ readonly EXECUTABLE: "executable";
4
+ readonly DISPOSE: "dispose";
5
+ };
6
+ export declare const MEDIA_TYPE: {
7
+ readonly APNG: "APNG";
8
+ readonly MP4: "MP4";
9
+ readonly WebM: "WebM";
10
+ readonly Images: "Images";
11
+ readonly WebP: "WebP";
12
+ readonly GIF: "GIF";
13
+ readonly AlphaMaskVideo: "AlphaMaskVideo";
14
+ };
15
+ export declare const STAGE_MAP: {
16
+ readonly IDLE: "idle";
17
+ readonly CONVERT_IMAGE: "convertImage";
18
+ readonly TRANSCODING: "transcoding";
19
+ readonly AUDIO: "audio";
20
+ };
21
+ export declare const EXPORT_NEED_TRANS_IMAGES_MAP: {
22
+ JPEG: string;
23
+ WEBP: string;
24
+ PNG: string;
25
+ };
26
+ export declare const FORMAT_BUFFER_DOWNLOAD_SUFFIX: {
27
+ MP4: string;
28
+ WebP: string;
29
+ APNG: string;
30
+ GIF: string;
31
+ AlphaMaskVideo: string;
32
+ Images: string;
33
+ };
34
+ export declare const FORMAT_BUFFER_DOWNLOAD_MIMETYPE: {
35
+ MP4: string;
36
+ WebP: string;
37
+ APNG: string;
38
+ GIF: string;
39
+ AlphaMaskVideo: string;
40
+ Images: string;
41
+ };
42
+ export declare const EXPORT_STATUS_MAP: {
43
+ DEFAULT: string;
44
+ EXPORTING: string;
45
+ SUCCESS: string;
46
+ ERROR: string;
47
+ };
48
+ /**
49
+ * GIF 压缩参数
50
+ * 核心通过参数 flags + palettegen + paletteuse 实现
51
+ * highest: lanczos + max_colors=256 + dither=bayer
52
+ * high: bicubic + max_colors=200 + dither=bayer
53
+ * medium: bilinear + max_colors=64 + dither=bayer
54
+ * low: neighbor + max_colors=32 + dither=none
55
+ */
56
+ export declare const GIF_QUALITY_TO_FFMPEG_ARGS: {
57
+ highest: string;
58
+ high: string;
59
+ medium: string;
60
+ low: string;
61
+ };
62
+ /**
63
+ * APNG 压缩参数
64
+ * 核心通过参数 compression_level 实现,压缩等级分为 1/3/6/9
65
+ */
66
+ export declare const APNG_QUALITY_TO_FFMPEG_ARGS: {
67
+ highest: string;
68
+ high: string;
69
+ medium: string;
70
+ low: string;
71
+ };
@@ -0,0 +1,68 @@
1
+ import { EventEmitter } from '../shared';
2
+ import type { MediaType, ExportMediaInitOptions, ExportItemParams, ExportParams, Buffer, Extra, Buffers, Extras } from './types';
3
+ export type ExportMediaEvent = {
4
+ /**
5
+ * 环境准备完成
6
+ */
7
+ ready: [mediaType: MediaType];
8
+ /**
9
+ * 总体进度
10
+ */
11
+ progress: [progress: number];
12
+ /**
13
+ * 单个任务完成
14
+ */
15
+ done: [item: ExportItemParams | undefined, success: boolean, buffer: Buffer, extra: Extra];
16
+ /**
17
+ * 全部任务完成
18
+ */
19
+ finish: [success: boolean, taskInfos: ExportParams, buffers: Buffers, extras: Extras];
20
+ /**
21
+ * 异常
22
+ */
23
+ error: [error: any];
24
+ };
25
+ export declare class ExportMedia extends EventEmitter<ExportMediaEvent> {
26
+ #private;
27
+ private status;
28
+ private stage;
29
+ private player?;
30
+ constructor(options: ExportMediaInitOptions);
31
+ setMediaType(curMediaType: MediaType): void;
32
+ setOptions(options: Partial<ExportMediaInitOptions>): void;
33
+ get canceled(): boolean;
34
+ private get config();
35
+ private get mp4Config();
36
+ private get gifConfig();
37
+ private get apngConfig();
38
+ private get progress();
39
+ private get transImageType();
40
+ private onInit;
41
+ private onReset;
42
+ private onError;
43
+ private onFinish;
44
+ private loadHelper;
45
+ private getAllTaskFrames;
46
+ private setProgress;
47
+ private forwardPlayerTime;
48
+ private getWavAudio;
49
+ private getImagesZip;
50
+ private getWebP;
51
+ private getAPNG;
52
+ private getGIF;
53
+ private getMP4;
54
+ private getAlphaMaskVideo;
55
+ private getVideoByType;
56
+ private onRecordWebM;
57
+ private onExportImageFrame;
58
+ private onExportWebMFrame;
59
+ private runTask;
60
+ private clearTaskInfo;
61
+ private clearFFMpegCore;
62
+ private clearImage2WebPCore;
63
+ private clearMediaRecorder;
64
+ private clearAllListeners;
65
+ onCancel(): void;
66
+ onExport(options: ExportParams): Promise<void>;
67
+ dispose(): void;
68
+ }
@@ -0,0 +1,22 @@
1
+ import type { ExportMediaInitOptions, ExportItemParams, ExportParams, ExportMediaItemDownloadInfo, FileBuffer, Buffers, Extras } from './types';
2
+ import { EventEmitter } from '../shared';
3
+ export type ExporterEvent = {
4
+ 'progress': [progress: number];
5
+ 'done': [item: ExportItemParams | undefined, success: boolean, buffer?: FileBuffer, extra?: FileBuffer | null];
6
+ 'complete': [success: boolean, taskInfos: ExportParams, buffers: Buffers, extras: Extras];
7
+ };
8
+ export declare class Exporter extends EventEmitter<ExporterEvent> {
9
+ private _options;
10
+ private _status;
11
+ private _exportMedia;
12
+ constructor(options: ExportMediaInitOptions);
13
+ get status(): string;
14
+ setOptions(options: Partial<ExportMediaInitOptions>): void;
15
+ downloadByMediaBuffers(params: ExportMediaItemDownloadInfo[], buffers: Buffers, extras: Extras): void;
16
+ private onExportProgress;
17
+ private onExportDone;
18
+ private onExportError;
19
+ onExport(params: ExportParams): void;
20
+ onCancel(): void;
21
+ dispose(): void;
22
+ }
@@ -0,0 +1,2 @@
1
+ export type { ExportItemParams, ExportParams, ExportMediaInitOptions, ExportMediaItemDownloadInfo, ExportMediaItemOptions, FileBuffer, Buffers, Extras } from './types';
2
+ export * from './exporter';
@@ -0,0 +1,194 @@
1
+ import { spec } from '../shared';
2
+ import { STATUS_MAP, MEDIA_TYPE, STAGE_MAP, EXPORT_STATUS_MAP, GIF_QUALITY_TO_FFMPEG_ARGS } from './const';
3
+ declare global {
4
+ interface Window {
5
+ /**
6
+ * @description 创建 WebP Core 实例
7
+ */
8
+ createWebPCore: (config: any) => Promise<Img2WebPCore>;
9
+ }
10
+ }
11
+ export type FileBuffer = ArrayBuffer | Uint8Array;
12
+ export type Status = typeof STATUS_MAP[keyof typeof STATUS_MAP];
13
+ export type MediaType = typeof MEDIA_TYPE[keyof typeof MEDIA_TYPE];
14
+ export type ExportImageFrameOptions = {
15
+ canvas: HTMLCanvasElement;
16
+ imageBuffers: ArrayBuffer[];
17
+ startTime: number;
18
+ oldTotalTime: number;
19
+ newTotalTime?: number;
20
+ backgroundCanvas?: HTMLCanvasElement;
21
+ };
22
+ export type RunExportTaskOptions = {
23
+ size: [number, number];
24
+ startTime: number;
25
+ containerCanvas: HTMLCanvasElement;
26
+ background?: {
27
+ backgroundCanvas?: HTMLCanvasElement;
28
+ backgroundImage?: HTMLImageElement;
29
+ };
30
+ };
31
+ export type FS = {
32
+ writeFile: (path: string, data: Uint8Array | string) => void;
33
+ readFile(path: string, opts: {
34
+ encoding: 'binary';
35
+ flags?: string | undefined;
36
+ }): Uint8Array;
37
+ readFile(path: string, opts: {
38
+ encoding: 'utf8';
39
+ flags?: string | undefined;
40
+ }): string;
41
+ readFile(path: string, opts?: {
42
+ flags?: string | undefined;
43
+ }): Uint8Array;
44
+ unlink: (path: string) => void;
45
+ quit: () => void;
46
+ };
47
+ type Pointer = number;
48
+ export type Img2WebPCore = {
49
+ FS: FS;
50
+ run: (...args: string[]) => number;
51
+ cwrap: (ident: string, returnType: string, argTypes: string[]) => ((argc: number, argv: Pointer) => number);
52
+ _malloc: (size: number) => Pointer;
53
+ writeAsciiToMemory: (str: string, buffer: number, dontAddNull?: boolean) => void;
54
+ setValue: (ptr: number, value: any, type: string, noSafe?: boolean) => void;
55
+ };
56
+ export type Config = {
57
+ name: string;
58
+ oldTotalTime: number;
59
+ newTotalTime?: number;
60
+ startTime: number;
61
+ fps: number;
62
+ backgroundColor: string;
63
+ loop: boolean;
64
+ audioEnable: boolean;
65
+ };
66
+ export type Stage = typeof STAGE_MAP[keyof typeof STAGE_MAP];
67
+ export type ExportStatus = typeof EXPORT_STATUS_MAP[keyof typeof EXPORT_STATUS_MAP];
68
+ export type ExportMediaInitOptions = {
69
+ /**
70
+ * 导出类型
71
+ */
72
+ mediaType: MediaType;
73
+ /**
74
+ * 额外画布,导出透明视频时使用
75
+ */
76
+ extraCanvas?: HTMLCanvasElement | null;
77
+ /**
78
+ * 是否打印转码过程中的日志,仅在导出 MP4/AlphaMaskVideo 时有效, 默认 false
79
+ * 供开发调试使用
80
+ */
81
+ loggerInTranscoding?: boolean;
82
+ /**
83
+ * ffmpeg 转码是否开启多线程,默认 false,确保环境支持 SharedArrayBuffer
84
+ */
85
+ multiThreading?: boolean;
86
+ /**
87
+ * 是否输出 buffer,默认 false
88
+ */
89
+ isOutputBuffer?: boolean;
90
+ };
91
+ export type MP4Config = {
92
+ /**
93
+ * @description MP4 导出时是否需要导出最后一帧 PNG
94
+ */
95
+ isExportLastFrameJPEG?: boolean;
96
+ };
97
+ export type GifConfig = {
98
+ /**
99
+ * @description GIF 导出时的帧率
100
+ */
101
+ fps?: number;
102
+ /**
103
+ * @description GIF 导出时的缩放比例
104
+ * 默认 '-1:-1', 表示不缩放
105
+ * 例如 '100:-1', 表示宽度 100,高度自动
106
+ * 例如 '-1:100', 表示宽度自动,高度 100
107
+ */
108
+ scale?: string;
109
+ /**
110
+ * @description GIF 导出时的质量
111
+ * 默认 'highest'
112
+ * 可选 'highest', 'high', 'medium', 'low'
113
+ */
114
+ quality?: keyof typeof GIF_QUALITY_TO_FFMPEG_ARGS;
115
+ };
116
+ export type ApngConfig = {
117
+ /**
118
+ * @description APNG 导出时的帧率
119
+ */
120
+ fps?: number;
121
+ /**
122
+ * @description APNG 导出时的缩放比例
123
+ * 默认 '-1:-1', 表示不缩放
124
+ * 例如 '100:-1', 表示宽度 100,高度自动
125
+ * 例如 '-1:100', 表示宽度自动,高度 100
126
+ */
127
+ scale?: string;
128
+ /**
129
+ * @description APNG 导出时的质量
130
+ * 默认 'highest'
131
+ * 可选 'highest', 'high', 'medium', 'low'
132
+ */
133
+ quality?: keyof typeof GIF_QUALITY_TO_FFMPEG_ARGS;
134
+ };
135
+ export type ExportMediaItemOptions = {
136
+ /**
137
+ * 尺寸
138
+ */
139
+ size: [number, number];
140
+ /**
141
+ * 动效资源
142
+ */
143
+ scene: spec.JSONScene;
144
+ /**
145
+ * 视频时长,目前仅在导出 MP4 / AlphaMaskVideo 时有效,默认取动效资源时长
146
+ */
147
+ time?: number;
148
+ /**
149
+ * 是否生成音轨,默认 false,仅在导出 MP4 时有效
150
+ */
151
+ audioEnable?: boolean;
152
+ /**
153
+ * 帧率, 默认 30
154
+ */
155
+ fps?: number;
156
+ /**
157
+ * 是否循环,默认 true
158
+ */
159
+ loop?: boolean;
160
+ /**
161
+ * 视频背景颜色,默认 #000000
162
+ */
163
+ backgroundColor?: string;
164
+ /**
165
+ * 导出 MP4 时,设置的导出配置
166
+ */
167
+ mp4Config?: MP4Config;
168
+ /**
169
+ * 导出 GIF 时,设置的导出配置
170
+ */
171
+ gifConfig?: GifConfig;
172
+ /**
173
+ * 导出 APNG 时,设置的导出配置
174
+ */
175
+ apngConfig?: ApngConfig;
176
+ };
177
+ export type ExportOptions = ExportMediaItemOptions[];
178
+ export type ExportMediaItemDownloadInfo = {
179
+ /**
180
+ * @description 导出文件夹名称
181
+ */
182
+ folderName: string;
183
+ /**
184
+ * @description 导出视频名称
185
+ */
186
+ name: string;
187
+ };
188
+ export type ExportItemParams = ExportMediaItemOptions & ExportMediaItemDownloadInfo;
189
+ export type ExportParams = ExportItemParams[];
190
+ export type Buffer = FileBuffer | undefined;
191
+ export type Extra = FileBuffer | null | undefined;
192
+ export type Buffers = FileBuffer[] | undefined;
193
+ export type Extras = (FileBuffer | null)[] | null | undefined;
194
+ export {};
@@ -0,0 +1,22 @@
1
+ import type { Img2WebPCore } from './types';
2
+ import { Player } from '@galacean/effects';
3
+ export declare function getTwoDecimal(num: number): number;
4
+ export declare function loadImageAsync(img: string | HTMLImageElement, noCrossOrigin?: boolean): Promise<HTMLImageElement>;
5
+ export declare function drawToOutputCanvas(playerCanvas: HTMLCanvasElement, canvas: HTMLCanvasElement, backgroundColor: string, backgroundCanvas?: HTMLCanvasElement): void;
6
+ export declare function getAlphaMaskImage(inputCanvas: HTMLCanvasElement, outputCanvas: HTMLCanvasElement): void;
7
+ export declare function parseArgs(Core: Img2WebPCore, args: string[]): number[];
8
+ export declare function canvasToArrayBuffer(canvas: HTMLCanvasElement, mime?: string, quality?: number): Promise<ArrayBuffer>;
9
+ export declare function sleepForOneFrame(): Promise<unknown>;
10
+ export declare function padZero(num: number, length: number): string;
11
+ export declare function loadWebpHelper(): Promise<Img2WebPCore>;
12
+ export type LoadFFmpegHelperOptions = {
13
+ multiThreading?: boolean;
14
+ };
15
+ export type LoadConfig = {
16
+ coreURL: string;
17
+ wasmURL: string;
18
+ workerURL?: string;
19
+ classWorkerURL?: string;
20
+ };
21
+ export declare function loadFFmpegHelper(options?: LoadFFmpegHelperOptions): Promise<import("@ffmpeg/ffmpeg").FFmpeg>;
22
+ export declare function clearPlayerAssets(player: Player): void;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * 生成 wav 音轨文件
3
+ * NOTE: 为什么不直接使用 ffmpeg 命令生成音轨?
4
+ * 因为直接使用 ffmpeg 命令生成音轨,会造成视频转码过程中存在 blocking 问题,
5
+ * 这里对于音轨要求不高,只是生成一个静音音轨,所以手动生成 wav 文件
6
+ */
7
+ export type WavAudioOptions = {
8
+ /**
9
+ * 采样率,默认 44100(标准采用率)
10
+ */
11
+ sampleRate?: number;
12
+ /**
13
+ * 时长,单位秒,默认 1
14
+ */
15
+ duration?: number;
16
+ /**
17
+ * 通道数,默认 2
18
+ */
19
+ channels?: number;
20
+ };
21
+ export declare class WavAudio {
22
+ sampleRate: number;
23
+ duration: number;
24
+ channels: number;
25
+ constructor(options?: WavAudioOptions);
26
+ getBuffer(): Uint8Array;
27
+ }
@@ -0,0 +1,68 @@
1
+ import { Graphics } from '@pixi/graphics';
2
+ import { Gizmo } from './gizmo';
3
+ import type { GizmoType, TranslationAdsorptionResult } from './type';
4
+ import { Vector2, type Box2 } from '../../math';
5
+ export declare class AdsorptionGizmo extends Gizmo {
6
+ /**
7
+ * @description 吸附对齐结果
8
+ */
9
+ private results;
10
+ /**
11
+ * @description 绘制图形
12
+ */
13
+ private graphics;
14
+ /**
15
+ * @description 吸附结果
16
+ */
17
+ absorptionResult: TranslationAdsorptionResult;
18
+ readonly type = "adsorption";
19
+ get interactive(): boolean;
20
+ set interactive(bool: boolean);
21
+ preparationAction(): GizmoType | undefined;
22
+ getCursorState(): undefined;
23
+ preAction(): undefined;
24
+ action(): void;
25
+ cancelPreparation(): void;
26
+ actionKey(): void;
27
+ endActionKey(): void;
28
+ endAction(): undefined;
29
+ interruption(): undefined;
30
+ /**
31
+ * @description 包围盒位移吸附功能
32
+ * @param shift 偏移值
33
+ * @param box 目标包围盒
34
+ * @param otherBoxes 吸附包围盒
35
+ * @param xEnabled 是否进行x轴吸附
36
+ * @param yEnabled 是否进行y周吸附
37
+ * @returns 无
38
+ */
39
+ boxTranslationAdsorption(shift: Vector2, box: Box2, otherBoxes: Box2[], xEnabled?: boolean, yEnabled?: boolean): void;
40
+ /**
41
+ * @description 点位移吸附功能
42
+ * @param shift 偏移值
43
+ * @param point 目标点
44
+ * @param otherPoints 吸附点集合
45
+ * @returns 无
46
+ */
47
+ pointTranslationAdsorption(shift: Vector2, point: Vector2, otherPoints: Vector2[], xEnabled?: boolean, yEnabled?: boolean): void;
48
+ /**
49
+ * @description 获取点吸附结果
50
+ * @param point 目标点
51
+ * @param other 吸附点
52
+ */
53
+ getPointAbsorption(point: Vector2, other: Vector2, xEnabled?: boolean, yEnabled?: boolean): void;
54
+ /**
55
+ * 刷新吸附结果
56
+ * @param point 目标点
57
+ * @param other 吸附点
58
+ * @param direction 吸附方向
59
+ */
60
+ refreshPointAbsorptionResult(point: Vector2, other: Vector2, direction: 'x' | 'y'): void;
61
+ /**
62
+ * 基于吸附结果生成对齐结果
63
+ */
64
+ refreshResults(): void;
65
+ refreshRenderObject(): void;
66
+ getRenderObjects(): Graphics[];
67
+ clearAbsorptionResult(): void;
68
+ }
@@ -0,0 +1,67 @@
1
+ import { Vector2 } from '../../math';
2
+ import type { PageDataUtils } from '../../utils/page-data-utils';
3
+ import { Gizmo } from './gizmo';
4
+ import type { ControlGizmoInteractionType, GestureCursorResult, GizmoType } from './type';
5
+ export declare class ControlGizmo extends Gizmo {
6
+ readonly type: GizmoType;
7
+ _interactionType: ControlGizmoInteractionType;
8
+ /**
9
+ * @description 是否处于交互态
10
+ */
11
+ active: boolean;
12
+ /**
13
+ * 上一时刻鼠标交互位置
14
+ */
15
+ lastPoint: Vector2;
16
+ cursorResult: GestureCursorResult;
17
+ SDKUtils: PageDataUtils;
18
+ get interactive(): boolean;
19
+ set interactive(bool: boolean);
20
+ get interactionType(): ControlGizmoInteractionType;
21
+ set interactionType(type: ControlGizmoInteractionType);
22
+ constructor(utils: PageDataUtils);
23
+ get useCameraControl(): boolean;
24
+ /**
25
+ * 行动准备事件[当buttons === 0,且在mouseMove时触发]
26
+ * @param event 鼠标事件
27
+ */
28
+ preparationAction(): GizmoType | undefined;
29
+ cancelPreparation(): void;
30
+ refreshResults(): void;
31
+ /**
32
+ * 行动前置事件[在mouseDown时触发]
33
+ * @param event 鼠标事件
34
+ */
35
+ preAction(event: MouseEvent): GizmoType | undefined;
36
+ /**
37
+ * 行动事件[当buttons !== 0,且在mouseMove时触发 || 2D模式下仅在onWheel中触发]
38
+ * @param event 鼠标事件
39
+ */
40
+ action(event: WheelEvent | MouseEvent): void;
41
+ /**
42
+ * 行动结束事件[在mouseUp时触发]
43
+ * @param event 鼠标事件
44
+ */
45
+ endAction(): GizmoType | undefined;
46
+ /**
47
+ * 交互中断事件 - ControlGizmo交互不会被中断
48
+ * @returns this
49
+ */
50
+ interruption(): GizmoType;
51
+ /**
52
+ * @description 键盘交互事件
53
+ * @param keyCode 键位信息
54
+ */
55
+ actionKey(): void;
56
+ /**
57
+ * @description 键盘交互结束事件
58
+ * @param keyCode 键位信息
59
+ */
60
+ endActionKey(): void;
61
+ refreshCursorResult(): void;
62
+ /**
63
+ * 获取辅助层渲染对象
64
+ * @returns 空
65
+ */
66
+ getRenderObjects(): [];
67
+ }
@@ -0,0 +1,59 @@
1
+ import type { Graphics } from '@pixi/graphics';
2
+ import type { Sprite } from '@pixi/sprite';
3
+ import type { GizmoType } from './type';
4
+ export declare abstract class Gizmo {
5
+ type: GizmoType;
6
+ /**
7
+ * @description 是否处于交互态
8
+ */
9
+ active: boolean;
10
+ /**
11
+ * 行动准备事件[当buttons === 0,且在mouseMove时触发]
12
+ * @param event 鼠标事件
13
+ */
14
+ abstract preparationAction(event: MouseEvent): GizmoType | undefined;
15
+ /**
16
+ * 行动前置事件[在mouseDown时触发]
17
+ * @param event 鼠标事件
18
+ */
19
+ abstract preAction(event: MouseEvent, isDoubleClick?: boolean): GizmoType | undefined;
20
+ /**
21
+ * 行动事件[当buttons !== 0,且在mouseMove时触发]
22
+ * @param event 鼠标事件
23
+ */
24
+ abstract action(event: MouseEvent): void;
25
+ /**
26
+ * 行动结束事件[在mouseUp时触发]
27
+ * @param event 鼠标事件
28
+ */
29
+ abstract endAction(event: MouseEvent): GizmoType | undefined;
30
+ /**
31
+ * 交互中断事件[在被其它交互打断时触发]
32
+ */
33
+ abstract interruption(): GizmoType | undefined;
34
+ /**
35
+ * @description 键盘交互事件
36
+ * @param keyCode 键位信息
37
+ */
38
+ abstract actionKey(keyCode: KeyboardEvent): void;
39
+ /**
40
+ * @description 键盘交互结束事件
41
+ * @param keyCode 键位信息
42
+ */
43
+ abstract endActionKey(keyCode: KeyboardEvent): void;
44
+ /**
45
+ * 取消预备状态 [在MouseMove时,如果已有交互模块,则后续模块都需要确认取消准备态,防止重复触发]
46
+ */
47
+ abstract cancelPreparation(): void;
48
+ /**
49
+ * @description 刷新结果
50
+ */
51
+ abstract refreshResults(): void;
52
+ /**
53
+ * 获取辅助面板渲染对象
54
+ */
55
+ abstract getRenderObjects(): (Graphics | Sprite)[];
56
+ get interactive(): boolean;
57
+ set interactive(bool: boolean);
58
+ constructor();
59
+ }
@@ -0,0 +1,44 @@
1
+ import { Sprite } from '@pixi/sprite';
2
+ import { Gizmo } from './gizmo';
3
+ import { GestureCursorResult, GizmoType, IconInteractionParam, IconResult, IconType } from './type';
4
+ import { PageDataUtils } from '../../utils/page-data-utils';
5
+ import { Vector2 } from '../../math';
6
+ import { SDKEvents } from '../../sdk';
7
+ import { EventEmitter } from '../../shared';
8
+ import { Texture } from '../../wireframe';
9
+ /**
10
+ * @description 用于渲染元素辅助Icon
11
+ */
12
+ export declare class IconGizmo extends Gizmo {
13
+ type: GizmoType;
14
+ results: IconResult[];
15
+ interactionParam: IconInteractionParam;
16
+ textureMap: Record<IconType, Texture> | undefined;
17
+ videoPlaySpriteTexture: Texture | undefined;
18
+ videoGeneratorTexture: Texture | undefined;
19
+ imageGeneratorTexture: Texture | undefined;
20
+ cursorResult: GestureCursorResult;
21
+ renderSprites: Sprite[];
22
+ private _pageDataUtils;
23
+ private _eventEmitter;
24
+ get interactive(): boolean;
25
+ set interactive(state: boolean);
26
+ constructor(pageDataUtils: PageDataUtils, emitter: EventEmitter<SDKEvents>);
27
+ init(): Promise<void>;
28
+ preparationAction(event: MouseEvent): GizmoType | undefined;
29
+ preAction(event: MouseEvent, isDoubleClick?: boolean): GizmoType | undefined;
30
+ action(event: MouseEvent): void;
31
+ endAction(event: MouseEvent): GizmoType | undefined;
32
+ interruption(): GizmoType | undefined;
33
+ actionKey(keyCode: KeyboardEvent): void;
34
+ endActionKey(keyCode: KeyboardEvent): void;
35
+ cancelPreparation(): void;
36
+ refreshCursorResult(): void;
37
+ /**
38
+ * @description 根据鼠标位置,刷新视频播放Icon的状态
39
+ * @param mouse 鼠标位置
40
+ */
41
+ refreshVideoIconId(mouse: Vector2): void;
42
+ refreshResults(): void;
43
+ getRenderObjects(): (Sprite)[];
44
+ }
@@ -0,0 +1,6 @@
1
+ export * from './type';
2
+ export * from './gizmo';
3
+ export * from './control-gizmo';
4
+ export * from './selector-gizmo';
5
+ export * from './transform-gizmo';
6
+ export * from './adsorption-gizmo';