@vvfx/artis 0.0.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 (224) hide show
  1. package/LICENSE +22 -0
  2. package/dist/artis/artis.d.ts +44 -0
  3. package/dist/artis/base-artis.d.ts +520 -0
  4. package/dist/artis/canvas-layer-order.d.ts +19 -0
  5. package/dist/artis/create-info-to-schema.d.ts +21 -0
  6. package/dist/artis/index.d.ts +15 -0
  7. package/dist/artis/operations/index.d.ts +3 -0
  8. package/dist/artis/operations/operations.d.ts +362 -0
  9. package/dist/artis/operations/scene-operations.d.ts +26 -0
  10. package/dist/artis/operations/types.d.ts +39 -0
  11. package/dist/artis/scene-artis.d.ts +386 -0
  12. package/dist/artis/screenshot-service.d.ts +83 -0
  13. package/dist/artis/types.d.ts +130 -0
  14. package/dist/artis/wiring/index.d.ts +17 -0
  15. package/dist/artis/wiring/register-commands.d.ts +44 -0
  16. package/dist/artis/wiring/setup-commands.d.ts +5 -0
  17. package/dist/artis/wiring/setup-event-bindings.d.ts +16 -0
  18. package/dist/artis/wiring/setup-keybindings.d.ts +38 -0
  19. package/dist/artis/wiring/setup-plugins.d.ts +5 -0
  20. package/dist/artis/wiring/wiring-context.d.ts +34 -0
  21. package/dist/artis-sdk/artis-sdk.d.ts +1117 -0
  22. package/dist/artis-sdk/index.d.ts +1 -0
  23. package/dist/core/asset/asset-manager.d.ts +288 -0
  24. package/dist/core/asset/index.d.ts +3 -0
  25. package/dist/core/command/command-service.d.ts +315 -0
  26. package/dist/core/command/commands/composite-command.d.ts +45 -0
  27. package/dist/core/command/commands/frame-layout-command.d.ts +81 -0
  28. package/dist/core/command/commands/frame-layout-mode-command.d.ts +55 -0
  29. package/dist/core/command/commands/frame-move-in-command.d.ts +54 -0
  30. package/dist/core/command/commands/frame-move-out-command.d.ts +54 -0
  31. package/dist/core/command/commands/group-children-detach-command.d.ts +28 -0
  32. package/dist/core/command/commands/index.d.ts +98 -0
  33. package/dist/core/command/commands/item-align-command.d.ts +52 -0
  34. package/dist/core/command/commands/item-create-command.d.ts +66 -0
  35. package/dist/core/command/commands/item-delete-command.d.ts +40 -0
  36. package/dist/core/command/commands/item-distribute-command.d.ts +53 -0
  37. package/dist/core/command/commands/item-group-command.d.ts +41 -0
  38. package/dist/core/command/commands/item-reorder-command.d.ts +41 -0
  39. package/dist/core/command/commands/item-replace-source-command.d.ts +48 -0
  40. package/dist/core/command/commands/item-set-font-family-command.d.ts +46 -0
  41. package/dist/core/command/commands/item-set-generator-resource-command.d.ts +40 -0
  42. package/dist/core/command/commands/item-transform-command.d.ts +51 -0
  43. package/dist/core/command/commands/item-ungroup-command.d.ts +34 -0
  44. package/dist/core/command/commands/item-update-property-by-create-info-command.d.ts +41 -0
  45. package/dist/core/command/commands/item-update-property-command.d.ts +82 -0
  46. package/dist/core/command/commands/mask-commit-command.d.ts +53 -0
  47. package/dist/core/command/commands/page-auto-layout-command.d.ts +53 -0
  48. package/dist/core/command/commands/picture-cut-commit-command.d.ts +43 -0
  49. package/dist/core/command/commands/picture-expand-commit-command.d.ts +35 -0
  50. package/dist/core/command/commands/scene-switch-command.d.ts +35 -0
  51. package/dist/core/command/commands/selection-set-command.d.ts +38 -0
  52. package/dist/core/command/commands/sprite-image-command.d.ts +36 -0
  53. package/dist/core/command/commands/sprite-text-edit-commit-command.d.ts +43 -0
  54. package/dist/core/command/commands/state-hand-command.d.ts +14 -0
  55. package/dist/core/command/commands/state-image-cut-command.d.ts +14 -0
  56. package/dist/core/command/commands/state-image-expand-command.d.ts +14 -0
  57. package/dist/core/command/commands/state-image-mask-command.d.ts +15 -0
  58. package/dist/core/command/commands/state-image-text-edit-command.d.ts +14 -0
  59. package/dist/core/command/commands/state-item-create-command.d.ts +34 -0
  60. package/dist/core/command/commands/state-move-command.d.ts +14 -0
  61. package/dist/core/command/commands/state-switch-command-base.d.ts +41 -0
  62. package/dist/core/command/commands/text-move-command.d.ts +47 -0
  63. package/dist/core/command/commands/text-rotate-command.d.ts +52 -0
  64. package/dist/core/command/commands/text-scale-command.d.ts +56 -0
  65. package/dist/core/command/commands/text-update-content-command.d.ts +51 -0
  66. package/dist/core/command/commands/transform-move-command.d.ts +56 -0
  67. package/dist/core/command/commands/transform-move-with-frame-change-command.d.ts +80 -0
  68. package/dist/core/command/commands/transform-move-with-layout-command.d.ts +56 -0
  69. package/dist/core/command/commands/transform-rotate-command.d.ts +51 -0
  70. package/dist/core/command/commands/transform-scale-command.d.ts +54 -0
  71. package/dist/core/command/commands/video-play-command.d.ts +28 -0
  72. package/dist/core/command/commands/video-source-command.d.ts +39 -0
  73. package/dist/core/command/commands/viewport-fit-to-box-command.d.ts +37 -0
  74. package/dist/core/command/commands/viewport-fit-to-items-command.d.ts +43 -0
  75. package/dist/core/command/commands/viewport-move-command.d.ts +34 -0
  76. package/dist/core/command/commands/viewport-zoom-command.d.ts +35 -0
  77. package/dist/core/command/index.d.ts +5 -0
  78. package/dist/core/command/registry.d.ts +246 -0
  79. package/dist/core/command/types.d.ts +124 -0
  80. package/dist/core/element-registry/element-facade.d.ts +35 -0
  81. package/dist/core/element-registry/element-identity-strategy.d.ts +75 -0
  82. package/dist/core/element-registry/element-registry.d.ts +72 -0
  83. package/dist/core/element-registry/index.d.ts +5 -0
  84. package/dist/core/element-registry/types.d.ts +15 -0
  85. package/dist/core/gizmo/gizmo-bootstrap.d.ts +70 -0
  86. package/dist/core/gizmo/gizmo-command-binder.d.ts +55 -0
  87. package/dist/core/gizmo/gizmo-config-override.d.ts +24 -0
  88. package/dist/core/gizmo/gizmo-registry.d.ts +39 -0
  89. package/dist/core/gizmo/index.d.ts +19 -0
  90. package/dist/core/gizmo/register-gizmo-command-bindings.d.ts +20 -0
  91. package/dist/core/gizmo/state-gizmo-controller.d.ts +20 -0
  92. package/dist/core/history/history-manager.d.ts +174 -0
  93. package/dist/core/history/index.d.ts +1 -0
  94. package/dist/core/index.d.ts +25 -0
  95. package/dist/core/item/base-item.d.ts +154 -0
  96. package/dist/core/item/card-item.d.ts +91 -0
  97. package/dist/core/item/default-item-schema.d.ts +20 -0
  98. package/dist/core/item/effects-item.d.ts +99 -0
  99. package/dist/core/item/frame-item.d.ts +153 -0
  100. package/dist/core/item/generator-item.d.ts +114 -0
  101. package/dist/core/item/group-item.d.ts +51 -0
  102. package/dist/core/item/index.d.ts +25 -0
  103. package/dist/core/item/sprite-item.d.ts +80 -0
  104. package/dist/core/item/text-item.d.ts +171 -0
  105. package/dist/core/item/types.d.ts +158 -0
  106. package/dist/core/item/video-item.d.ts +120 -0
  107. package/dist/core/keybinding/index.d.ts +11 -0
  108. package/dist/core/keybinding/key-binding-controller.d.ts +44 -0
  109. package/dist/core/keybinding/key-binding-registry.d.ts +92 -0
  110. package/dist/core/keybinding/key-binding-store.d.ts +29 -0
  111. package/dist/core/keybinding/key-matcher.d.ts +24 -0
  112. package/dist/core/keybinding/types.d.ts +84 -0
  113. package/dist/core/plugin/index.d.ts +3 -0
  114. package/dist/core/plugin/io-plugin.d.ts +167 -0
  115. package/dist/core/plugin/plugin-system.d.ts +77 -0
  116. package/dist/core/predict/align-predict.d.ts +20 -0
  117. package/dist/core/predict/base/box-ops.d.ts +40 -0
  118. package/dist/core/predict/base/index.d.ts +14 -0
  119. package/dist/core/predict/base/parent-coord.d.ts +29 -0
  120. package/dist/core/predict/base/schema-box.d.ts +21 -0
  121. package/dist/core/predict/distribute-predict.d.ts +19 -0
  122. package/dist/core/predict/frame-layout-predict.d.ts +24 -0
  123. package/dist/core/predict/index.d.ts +12 -0
  124. package/dist/core/preferences/index.d.ts +2 -0
  125. package/dist/core/preferences/user-preferences-manager.d.ts +130 -0
  126. package/dist/core/quality/error-monitor/error-monitor-facade.d.ts +73 -0
  127. package/dist/core/quality/error-monitor/error-monitor.d.ts +106 -0
  128. package/dist/core/quality/error-monitor/index.d.ts +4 -0
  129. package/dist/core/quality/error-monitor/types.d.ts +198 -0
  130. package/dist/core/quality/index.d.ts +3 -0
  131. package/dist/core/quality/perf-monitor/index.d.ts +5 -0
  132. package/dist/core/quality/perf-monitor/perf-monitor-facade.d.ts +45 -0
  133. package/dist/core/quality/perf-monitor/perf-monitor.d.ts +60 -0
  134. package/dist/core/quality/perf-monitor/types.d.ts +66 -0
  135. package/dist/core/quality/stability-monitor/index.d.ts +5 -0
  136. package/dist/core/quality/stability-monitor/stability-monitor-facade.d.ts +50 -0
  137. package/dist/core/quality/stability-monitor/stability-monitor.d.ts +61 -0
  138. package/dist/core/quality/stability-monitor/types.d.ts +69 -0
  139. package/dist/core/renderer/background-controller.d.ts +56 -0
  140. package/dist/core/renderer/index.d.ts +5 -0
  141. package/dist/core/renderer/player-adapter.d.ts +129 -0
  142. package/dist/core/renderer/renderer.d.ts +134 -0
  143. package/dist/core/service/frame-service.d.ts +116 -0
  144. package/dist/core/service/index.d.ts +9 -0
  145. package/dist/core/service/interaction-providers.d.ts +20 -0
  146. package/dist/core/service/interaction-service.d.ts +211 -0
  147. package/dist/core/service/item-asset-service.d.ts +120 -0
  148. package/dist/core/service/item-creator-service.d.ts +211 -0
  149. package/dist/core/service/item-service.d.ts +641 -0
  150. package/dist/core/service/item-sync-service.d.ts +66 -0
  151. package/dist/core/service/json-scene-sync-service.d.ts +140 -0
  152. package/dist/core/service/refresh-animation-base-service.d.ts +1 -0
  153. package/dist/core/service/scene-data-assembler.d.ts +166 -0
  154. package/dist/core/service/view-service.d.ts +202 -0
  155. package/dist/core/state/base-state.d.ts +28 -0
  156. package/dist/core/state/index.d.ts +6 -0
  157. package/dist/core/state/presets.d.ts +25 -0
  158. package/dist/core/state/state-manager.d.ts +50 -0
  159. package/dist/core/state/types.d.ts +52 -0
  160. package/dist/core/store/index.d.ts +3 -0
  161. package/dist/core/store/scene-store.d.ts +194 -0
  162. package/dist/core/store/store.d.ts +36 -0
  163. package/dist/core/types/artis-config.d.ts +186 -0
  164. package/dist/core/types/artis-events.d.ts +101 -0
  165. package/dist/core/types/frame.d.ts +3 -0
  166. package/dist/core/types/generator.d.ts +28 -0
  167. package/dist/core/types/index.d.ts +15 -0
  168. package/dist/core/types/item-create-info.d.ts +205 -0
  169. package/dist/core/types/item-property.d.ts +149 -0
  170. package/dist/core/types/item-reorder.d.ts +12 -0
  171. package/dist/core/types/item-schema.d.ts +263 -0
  172. package/dist/core/types/item-set-property.d.ts +48 -0
  173. package/dist/core/types/page.d.ts +40 -0
  174. package/dist/core/types/sdk.d.ts +28 -0
  175. package/dist/core/types/view.d.ts +39 -0
  176. package/dist/helper/exporter/config.d.ts +18 -0
  177. package/dist/helper/exporter/const.d.ts +71 -0
  178. package/dist/helper/exporter/export-media.d.ts +189 -0
  179. package/dist/helper/exporter/exporter.d.ts +58 -0
  180. package/dist/helper/exporter/index.d.ts +2 -0
  181. package/dist/helper/exporter/types.d.ts +194 -0
  182. package/dist/helper/exporter/utils.d.ts +71 -0
  183. package/dist/helper/exporter/wav-audio.d.ts +35 -0
  184. package/dist/helper/html-overlay/anchor-navigation-runtime.d.ts +1 -0
  185. package/dist/helper/html-overlay/auto-height-layout.d.ts +16 -0
  186. package/dist/helper/html-overlay/auto-height-runtime.d.ts +40 -0
  187. package/dist/helper/html-overlay/document-runtime.d.ts +18 -0
  188. package/dist/helper/html-overlay/document-transform.d.ts +46 -0
  189. package/dist/helper/html-overlay/dom-order.d.ts +5 -0
  190. package/dist/helper/html-overlay/host-message-runtime.d.ts +15 -0
  191. package/dist/helper/html-overlay/html-capture-runtime.d.ts +12 -0
  192. package/dist/helper/html-overlay/html-card-service.d.ts +287 -0
  193. package/dist/helper/html-overlay/html-viewport-style.d.ts +6 -0
  194. package/dist/helper/html-overlay/index.d.ts +1 -0
  195. package/dist/helper/html-overlay/inline-script-json.d.ts +1 -0
  196. package/dist/helper/html-overlay/mime-utils.d.ts +13 -0
  197. package/dist/helper/html-overlay/overlay-transform.d.ts +30 -0
  198. package/dist/helper/html-overlay/path-utils.d.ts +34 -0
  199. package/dist/helper/html-overlay/runtime-context.d.ts +2 -0
  200. package/dist/helper/html-overlay/shell-runtime.d.ts +13 -0
  201. package/dist/helper/index.d.ts +5 -0
  202. package/dist/helper/scene-builder.d.ts +111 -0
  203. package/dist/helper/screen-shot.d.ts +51 -0
  204. package/dist/helper/size-adapt.d.ts +88 -0
  205. package/dist/index.cjs +69350 -0
  206. package/dist/index.cjs.map +1 -0
  207. package/dist/index.d.ts +19 -0
  208. package/dist/index.mjs +68963 -0
  209. package/dist/index.mjs.map +1 -0
  210. package/dist/shared/index.d.ts +1 -0
  211. package/dist/shared/player.d.ts +9 -0
  212. package/dist/utils/background-manager.d.ts +76 -0
  213. package/dist/utils/common-utils.d.ts +39 -0
  214. package/dist/utils/container-size.d.ts +7 -0
  215. package/dist/utils/find-player-item.d.ts +9 -0
  216. package/dist/utils/index.d.ts +11 -0
  217. package/dist/utils/json-data-utils.d.ts +198 -0
  218. package/dist/utils/layout-utils.d.ts +144 -0
  219. package/dist/utils/pixel-box-utils.d.ts +26 -0
  220. package/dist/utils/player-data-utils.d.ts +9 -0
  221. package/dist/utils/player-utils.d.ts +42 -0
  222. package/dist/utils/replay-utils.d.ts +22 -0
  223. package/dist/utils/types.d.ts +130 -0
  224. package/package.json +66 -0
@@ -0,0 +1,51 @@
1
+ import type { Command } from '../types';
2
+ import type { ItemService } from '../../service';
3
+ import type { Store } from '../../store';
4
+ export type RotateSnapshot = {
5
+ position: [number, number];
6
+ rotation: number;
7
+ };
8
+ export type TransformRotateCommandArgs = {
9
+ itemIds: string[];
10
+ newSnapshots: Map<string, RotateSnapshot>;
11
+ itemService: ItemService;
12
+ store: Store;
13
+ };
14
+ /**
15
+ * transform.rotate - 旋转元素 Command(支持多选)
16
+ *
17
+ * execute: 应用新的 rotation + position(多元素绕中心旋转时 position 也变)
18
+ * undo: 恢复到旋转前的快照
19
+ * redo: 重新应用旋转后的快照
20
+ * merge: 同一批元素连续旋转合并(保留最初 old,更新 new)
21
+ */
22
+ export declare class TransformRotateCommand implements Command {
23
+ readonly id: string;
24
+ readonly commandId = "transform.rotate";
25
+ private _itemIds;
26
+ private _newSnapshots;
27
+ private _oldSnapshots;
28
+ private _itemService;
29
+ private _store;
30
+ /**
31
+ * 初始化旋转命令,记录目标元素与新旧旋转快照
32
+ * @param args 命令参数(itemIds、新快照映射、itemService、store)
33
+ */
34
+ constructor(args: TransformRotateCommandArgs);
35
+ /** 返回受影响的元素 ID 列表 */
36
+ get itemIds(): string[];
37
+ /** 返回各元素旋转前的原始快照 */
38
+ get oldSnapshots(): Map<string, RotateSnapshot>;
39
+ /** 应用新旋转快照,首次执行时捕获各元素原始 position/rotation */
40
+ execute(): void;
41
+ /** 撤销旋转,将各元素恢复到原始快照 */
42
+ undo(): void;
43
+ /** 重做旋转,重新应用新旋转快照 */
44
+ redo(): void;
45
+ /**
46
+ * 合并连续的同批元素旋转命令,保留最初旧快照、更新新快照为目标值
47
+ * @param other 后续命令
48
+ * @returns 是否合并成功
49
+ */
50
+ merge(other: Command): boolean;
51
+ }
@@ -0,0 +1,54 @@
1
+ import type { Command } from '../types';
2
+ import type { ItemService } from '../../service';
3
+ import type { Store } from '../../store';
4
+ export type ScaleSnapshot = {
5
+ position: [number, number];
6
+ scale: [number, number];
7
+ rotation: number;
8
+ width: number;
9
+ height: number;
10
+ };
11
+ export type TransformScaleCommandArgs = {
12
+ itemIds: string[];
13
+ newSnapshots: Map<string, ScaleSnapshot>;
14
+ itemService: ItemService;
15
+ store: Store;
16
+ };
17
+ /**
18
+ * transform.scale - 缩放元素 Command(支持多选)
19
+ *
20
+ * execute: 应用新的 position/scale/rotation/size 快照
21
+ * undo: 恢复到缩放前的快照
22
+ * redo: 重新应用缩放后的快照
23
+ * merge: 同一批元素连续缩放合并(保留最初 old,更新 new)
24
+ */
25
+ export declare class TransformScaleCommand implements Command {
26
+ readonly id: string;
27
+ readonly commandId = "transform.scale";
28
+ private _itemIds;
29
+ private _newSnapshots;
30
+ private _oldSnapshots;
31
+ private _itemService;
32
+ private _store;
33
+ /**
34
+ * 初始化缩放命令,记录目标元素与新旧缩放快照
35
+ * @param args 命令参数(itemIds、新快照映射、itemService、store)
36
+ */
37
+ constructor(args: TransformScaleCommandArgs);
38
+ /** 返回受影响的元素 ID 列表 */
39
+ get itemIds(): string[];
40
+ /** 返回各元素缩放前的原始快照 */
41
+ get oldSnapshots(): Map<string, ScaleSnapshot>;
42
+ /** 应用新缩放快照,首次执行时捕获各元素原始 position/scale/rotation/size */
43
+ execute(): void;
44
+ /** 撤销缩放,将各元素恢复到原始快照 */
45
+ undo(): void;
46
+ /** 重做缩放,重新应用新缩放快照 */
47
+ redo(): void;
48
+ /**
49
+ * 合并连续的同批元素缩放命令,保留最初旧快照、更新新快照为目标值
50
+ * @param other 后续命令
51
+ * @returns 是否合并成功
52
+ */
53
+ merge(other: Command): boolean;
54
+ }
@@ -0,0 +1,28 @@
1
+ import type { Command } from '../types';
2
+ export type VideoPlayCommandArgs = {
3
+ itemId: string;
4
+ applyPlay: (itemId: string) => void;
5
+ };
6
+ /**
7
+ * video.play - 触发视频播放 Command(不入 History)
8
+ *
9
+ * execute: 触发指定视频元素的播放
10
+ * undo/redo: 空操作(播放行为无需撤销)
11
+ */
12
+ export declare class VideoPlayCommand implements Command {
13
+ readonly id: string;
14
+ readonly commandId = "video.play";
15
+ private _itemId;
16
+ private _applyPlay;
17
+ /**
18
+ * 初始化视频播放命令
19
+ * @param args 命令参数(itemId、播放回调 applyPlay)
20
+ */
21
+ constructor(args: VideoPlayCommandArgs);
22
+ /** 触发指定视频元素的播放 */
23
+ execute(): void;
24
+ /** 空操作:播放行为无需撤销 */
25
+ undo(): void;
26
+ /** 空操作:播放行为无需重做 */
27
+ redo(): void;
28
+ }
@@ -0,0 +1,39 @@
1
+ import type { Command } from '../types';
2
+ import type { ItemService } from '../../service';
3
+ import type { Store } from '../../store';
4
+ export type VideoSourceCommandArgs = {
5
+ itemId: string;
6
+ newVideoUrl: string;
7
+ itemService: ItemService;
8
+ store: Store;
9
+ };
10
+ /**
11
+ * video.source - 修改 Video 元素视频源 Command
12
+ *
13
+ * execute: 将元素视频源替换为新 URL(auto 状态下顺带按新资源原生尺寸收敛)
14
+ * undo: 恢复旧 URL(auto 状态下顺带按旧资源原生尺寸收敛——尺寸随换源实时算,故 URL 与尺寸原子回退)
15
+ * redo: 重新应用新 URL
16
+ *
17
+ * 对齐 {@link SpriteImageCommand}:换源尺寸由 {@link ItemService.applyAutoSizeByElementAsset}
18
+ * 在资源就绪后按当前资源实时算,而非命令 snapshot,故 undo/redo 仅回退 URL、尺寸随之自动收敛。
19
+ */
20
+ export declare class VideoSourceCommand implements Command {
21
+ readonly id: string;
22
+ readonly commandId = "video.source";
23
+ private _itemId;
24
+ private _newVideoUrl;
25
+ private _oldVideoUrl;
26
+ private _itemService;
27
+ private _store;
28
+ /**
29
+ * 构造视频源修改命令,并从 store 中快照旧视频 URL
30
+ * @param args 命令参数(含元素 id、新视频 URL、ItemService、Store)
31
+ */
32
+ constructor(args: VideoSourceCommandArgs);
33
+ /** 将元素视频源替换为新 URL */
34
+ execute(): void;
35
+ /** 恢复旧视频源 */
36
+ undo(): void;
37
+ /** 重新应用新视频源 */
38
+ redo(): void;
39
+ }
@@ -0,0 +1,37 @@
1
+ import type { Box2 } from '@vvfx/gizmo';
2
+ import type { ViewportFitShiftParam } from '../../types';
3
+ import type { Command } from '../types';
4
+ export type ViewportFitToBoxCommandArgs = {
5
+ box?: Box2;
6
+ shiftParam?: ViewportFitShiftParam;
7
+ contentRatio?: number;
8
+ applyFitToBox: (box?: Box2, shiftParam?: ViewportFitShiftParam) => void;
9
+ };
10
+ /**
11
+ * viewport.fitToBox - 视图自适应包围盒 Command(不入 History)
12
+ *
13
+ * execute: 使目标内容包围盒完整显示在容器中
14
+ * undo/redo: 空操作(视口操作无需撤销)
15
+ *
16
+ * isHistorical=false:视口适配非编辑动作,不进 History(收口在 CommandService._pushToHistory 咽喉)。
17
+ */
18
+ export declare class ViewportFitToBoxCommand implements Command {
19
+ readonly id: string;
20
+ readonly commandId = "viewport.fitToBox";
21
+ /** 不入 History:视口适配非编辑动作 */
22
+ readonly isHistorical = false;
23
+ private _box;
24
+ private _shiftParam?;
25
+ private _applyFitToBox;
26
+ /**
27
+ * 初始化视图自适应命令
28
+ * @param args 命令参数(包围盒 box、内边距 shiftParam、放大系数 contentRatio、应用回调 applyFitToBox)
29
+ */
30
+ constructor(args: ViewportFitToBoxCommandArgs);
31
+ /** 使目标内容包围盒完整显示在容器中 */
32
+ execute(): void;
33
+ /** 空操作:视口操作无需撤销 */
34
+ undo(): void;
35
+ /** 空操作:视口操作无需重做 */
36
+ redo(): void;
37
+ }
@@ -0,0 +1,43 @@
1
+ import type { ViewportFitShiftParam } from '../../types';
2
+ import type { Command } from '../types';
3
+ export type ViewportFitToItemsCommandArgs = {
4
+ /** 目标元素 ID 集合;缺省/空数组时聚焦所有元素(由 applyFitToItems 内部兜底) */
5
+ itemIds?: string[];
6
+ shiftParam?: ViewportFitShiftParam;
7
+ /**
8
+ * 视口适配应用回调:由调用方(wiring)负责按 itemIds 取盒并执行 fitToBox。
9
+ * - itemIds 未传/为空 → 聚焦所有元素;
10
+ * - 否则取这些元素的包围盒并集后 fit。
11
+ * 命令只持有入参,取盒/坐标系换算收口在 wiring(与 ViewportFitToBox 一致:命令不依赖运行时服务)。
12
+ */
13
+ applyFitToItems: (itemIds: string[] | undefined, shiftParam?: ViewportFitShiftParam) => void;
14
+ };
15
+ /**
16
+ * viewport.fitToItems - 按元素 ID 集合自适应视口 Command(不入 History)
17
+ *
18
+ * execute: 取指定元素包围盒并集 / 缺省取全部元素,使整体完整显示在容器中
19
+ * undo/redo: 空操作(视口操作无需撤销)
20
+ *
21
+ * isHistorical=false:与 viewport.fitToBox 同属视口适配非编辑动作,不进 History
22
+ * (收口在 CommandService._pushToHistory 咽喉)。
23
+ */
24
+ export declare class ViewportFitToItemsCommand implements Command {
25
+ readonly id: string;
26
+ readonly commandId = "viewport.fitToItems";
27
+ /** 不入 History:视口适配非编辑动作 */
28
+ readonly isHistorical = false;
29
+ private _itemIds;
30
+ private _shiftParam?;
31
+ private _applyFitToItems;
32
+ /**
33
+ * 初始化按元素集合自适应命令
34
+ * @param args 命令参数(元素 ID 集合 itemIds、内边距 shiftParam、应用回调 applyFitToItems)
35
+ */
36
+ constructor(args: ViewportFitToItemsCommandArgs);
37
+ /** 取指定元素包围盒并集(缺省全部元素)后自适应视口 */
38
+ execute(): void;
39
+ /** 空操作:视口操作无需撤销 */
40
+ undo(): void;
41
+ /** 空操作:视口操作无需重做 */
42
+ redo(): void;
43
+ }
@@ -0,0 +1,34 @@
1
+ import type { Command } from '../types';
2
+ export type ViewportMoveCommandArgs = {
3
+ deltaX: number;
4
+ deltaY: number;
5
+ applyMove: (dx: number, dy: number) => void;
6
+ };
7
+ /**
8
+ * viewport.move - 视图平移 Command(不入 History)
9
+ *
10
+ * execute: 按 delta 平移视图
11
+ * undo/redo: 空操作(视口操作无需撤销)
12
+ *
13
+ * isHistorical=false:视口平移非编辑动作,不进 History(收口在 CommandService._pushToHistory 咽喉)。
14
+ */
15
+ export declare class ViewportMoveCommand implements Command {
16
+ readonly id: string;
17
+ readonly commandId = "viewport.move";
18
+ /** 不入 History:视口平移非编辑动作 */
19
+ readonly isHistorical = false;
20
+ private _deltaX;
21
+ private _deltaY;
22
+ private _applyMove;
23
+ /**
24
+ * 初始化视图平移命令
25
+ * @param args 命令参数(deltaX、deltaY、平移回调 applyMove)
26
+ */
27
+ constructor(args: ViewportMoveCommandArgs);
28
+ /** 按 delta 平移视图 */
29
+ execute(): void;
30
+ /** 空操作:视口操作无需撤销 */
31
+ undo(): void;
32
+ /** 空操作:视口操作无需重做 */
33
+ redo(): void;
34
+ }
@@ -0,0 +1,35 @@
1
+ import { Vector2 } from '@vvfx/gizmo';
2
+ import type { Command } from '../types';
3
+ export type ViewportZoomCommandArgs = {
4
+ zoomDelta: number;
5
+ center: Vector2;
6
+ applyZoom: (zoomDelta: number, center: Vector2) => void;
7
+ };
8
+ /**
9
+ * viewport.zoom - 视图缩放 Command(不入 History)
10
+ *
11
+ * execute: 以指定中心点进行缩放
12
+ * undo/redo: 空操作(视口操作无需撤销)
13
+ *
14
+ * isHistorical=false:视口缩放非编辑动作,不进 History(收口在 CommandService._pushToHistory 咽喉)。
15
+ */
16
+ export declare class ViewportZoomCommand implements Command {
17
+ readonly id: string;
18
+ readonly commandId = "viewport.zoom";
19
+ /** 不入 History:视口缩放非编辑动作 */
20
+ readonly isHistorical = false;
21
+ private _zoomDelta;
22
+ private _center;
23
+ private _applyZoom;
24
+ /**
25
+ * 初始化视图缩放命令
26
+ * @param args 命令参数(zoomDelta、center、缩放回调 applyZoom)
27
+ */
28
+ constructor(args: ViewportZoomCommandArgs);
29
+ /** 以指定中心点进行缩放 */
30
+ execute(): void;
31
+ /** 空操作:视口操作无需撤销 */
32
+ undo(): void;
33
+ /** 空操作:视口操作无需重做 */
34
+ redo(): void;
35
+ }
@@ -0,0 +1,5 @@
1
+ export { CommandService } from './command-service';
2
+ export type { CommandErrorEventHandler } from './command-service';
3
+ export type { Command, CommandFactory, HistoryOperation, CommandPhase, CommandLifecycleEvent } from './types';
4
+ export type { CommandRegistry } from './registry';
5
+ export * from './commands';
@@ -0,0 +1,246 @@
1
+ /**
2
+ * CommandRegistry —— commandId → 工厂入参(args) / 返回 Command 子类(result) 的类型映射表。
3
+ *
4
+ * CommandRegistry 用 <b>interface</b> 而非 type alias:interface 是 module augmentation 的硬性前提——
5
+ * 外部使用者经 `declare module '@vvfx/artis' { interface CommandRegistry {...} }` 合并自定义命令后,
6
+ * 其命令即获得 execute / registerCommand 两端的强类型推断(commandId 字面量反推 args 对象形状 +
7
+ * result 类型)。type alias 不支持声明合并。
8
+ *
9
+ * 这是 {@link CommandService.execute} / {@link CommandService.registerCommand} / beginInteraction /
10
+ * updateInteraction 四入口 `<K extends keyof CommandRegistry>` 重载的<b>类型真源</b>:由 commandId
11
+ * 字面量反推 args 对象形状与 result 类型,使静态调用点获得编译期校验 + IDE 具名提示。
12
+ *
13
+ * args 为<b>单参对象</b>(破坏性变更:原为位置参数 `...args: unknown[]`),形状源自各 Command 的
14
+ * `XxxCommandArgs` 去掉内部依赖(itemService/store/stateManager/gizmoManager/applyXxx 回调等由 wiring
15
+ * 工厂注入),故工厂体可 spread 透传 `new XxxCommand({ ...args, deps })`,删除原 `args[N] as T` cast 群。
16
+ *
17
+ * 无参命令(state.move 等)的 args 为 `Record<string, never>`,调用方传 `{}`(如 `execute('state.move', {})`)。
18
+ *
19
+ * <b>外部自定义命令的强类型</b>:经 module augmentation 合并本 interface 即可让命令获得同样两端类型——
20
+ * ```ts
21
+ * declare module '@vvfx/artis' {
22
+ * interface CommandRegistry {
23
+ * 'myCmd': { args: { count: number; label: string }; result: MyCmd }
24
+ * }
25
+ * }
26
+ * artis.command.execute('myCmd', { count: 1, label: 'x' }) // 有具名提示
27
+ * ```
28
+ * 未增强的自定义命令命中 string 兜底重载,仍可调用但无静态校验。
29
+ *
30
+ * 注意:本表与 {@link ../../artis/wiring/register-commands.ts | registerCommands} 注册集合、
31
+ * `COMMAND_TARGET_ID_EXTRACTORS`(ignored-interaction 守卫目标 id 提取器)应同源维护;新增命令三处
32
+ * 都要登记,否则 execute 命中 `unknown` 兜底(静默 drift)。
33
+ */
34
+ import type { Box2, Vector2, ItemCreateType } from '@vvfx/gizmo';
35
+ import type { ItemCreateCommand, ItemDeleteCommand, ItemTransformCommand, ItemUpdatePropertyCommand, ItemReorderCommand, ItemGroupCommand, ItemUngroupCommand, ItemAlignCommand, ItemDistributeCommand, ItemUpdatePropertyBySchemaCommand, ItemSetFontFamilyCommand, ItemSetGeneratorResourceCommand, SpriteImageCommand, VideoSourceCommand, StateItemCreateCommand, StateMoveCommand, StateHandCommand, StateImageCutCommand, StateImageExpandCommand, StateImageMaskCommand, StateImageTextEditCommand, ItemReplaceSourceCommand, FrameMoveInCommand, FrameMoveOutCommand, FrameLayoutCommand, FrameLayoutModeCommand, SelectionSetCommand, PageAutoLayoutCommand, ViewportMoveCommand, ViewportZoomCommand, ViewportFitToBoxCommand, ViewportFitToItemsCommand, SceneSwitchCommand, ReorderType, TransformData } from './commands';
36
+ import type { ItemSchema, PageAutoLayoutParam, ViewportFitShiftParam, LayoutInfo } from '../types';
37
+ import type { AlignType, DistributeType } from '../../utils/types';
38
+ export interface CommandRegistry {
39
+ 'item.create': {
40
+ args: {
41
+ schemas: ItemSchema | ItemSchema[];
42
+ };
43
+ result: ItemCreateCommand;
44
+ };
45
+ 'item.delete': {
46
+ args: {
47
+ itemId: string;
48
+ };
49
+ result: ItemDeleteCommand;
50
+ };
51
+ 'item.transform': {
52
+ args: {
53
+ itemId: string;
54
+ newTransform: TransformData;
55
+ };
56
+ result: ItemTransformCommand;
57
+ };
58
+ 'item.updateProperty': {
59
+ args: {
60
+ itemId: string;
61
+ propertyKey: string;
62
+ newValue: unknown;
63
+ };
64
+ result: ItemUpdatePropertyCommand;
65
+ };
66
+ 'item.reorder': {
67
+ args: {
68
+ itemId: string;
69
+ reorderType: ReorderType;
70
+ };
71
+ result: ItemReorderCommand;
72
+ };
73
+ 'item.group': {
74
+ args: {
75
+ childrenIds: string[];
76
+ };
77
+ result: ItemGroupCommand;
78
+ };
79
+ 'item.ungroup': {
80
+ args: {
81
+ groupId: string;
82
+ };
83
+ result: ItemUngroupCommand;
84
+ };
85
+ 'item.align': {
86
+ args: {
87
+ alignType: AlignType;
88
+ itemIds: string[];
89
+ };
90
+ result: ItemAlignCommand;
91
+ };
92
+ 'item.distribute': {
93
+ args: {
94
+ distributeType: DistributeType;
95
+ itemIds: string[];
96
+ };
97
+ result: ItemDistributeCommand;
98
+ };
99
+ 'item.updatePropertyBySchema': {
100
+ args: {
101
+ schema: ItemSchema | ItemSchema[];
102
+ };
103
+ result: ItemUpdatePropertyBySchemaCommand;
104
+ };
105
+ 'item.setFontFamily': {
106
+ args: {
107
+ itemId: string;
108
+ fontFamily: string;
109
+ fontUrl?: string;
110
+ };
111
+ result: ItemSetFontFamilyCommand;
112
+ };
113
+ 'item.setGeneratorResource': {
114
+ args: {
115
+ itemId: string;
116
+ resourceUrl: string;
117
+ };
118
+ result: ItemSetGeneratorResourceCommand;
119
+ };
120
+ 'sprite.image': {
121
+ args: {
122
+ itemId: string;
123
+ newImageUrl: string;
124
+ };
125
+ result: SpriteImageCommand;
126
+ };
127
+ 'video.source': {
128
+ args: {
129
+ itemId: string;
130
+ newVideoUrl: string;
131
+ };
132
+ result: VideoSourceCommand;
133
+ };
134
+ 'item.replaceSource': {
135
+ args: {
136
+ itemId: string;
137
+ newUrl: string;
138
+ };
139
+ result: ItemReplaceSourceCommand;
140
+ };
141
+ 'state.move': {
142
+ args: Record<string, never>;
143
+ result: StateMoveCommand;
144
+ };
145
+ 'state.hand': {
146
+ args: Record<string, never>;
147
+ result: StateHandCommand;
148
+ };
149
+ 'state.imageCut': {
150
+ args: Record<string, never>;
151
+ result: StateImageCutCommand;
152
+ };
153
+ 'state.imageExpand': {
154
+ args: Record<string, never>;
155
+ result: StateImageExpandCommand;
156
+ };
157
+ 'state.imageMask': {
158
+ args: Record<string, never>;
159
+ result: StateImageMaskCommand;
160
+ };
161
+ 'state.imageTextEdit': {
162
+ args: Record<string, never>;
163
+ result: StateImageTextEditCommand;
164
+ };
165
+ 'state.itemCreate': {
166
+ args: {
167
+ createType?: ItemCreateType;
168
+ };
169
+ result: StateItemCreateCommand;
170
+ };
171
+ 'frame.moveIn': {
172
+ args: {
173
+ itemIds: string[];
174
+ frameId: string;
175
+ };
176
+ result: FrameMoveInCommand;
177
+ };
178
+ 'frame.moveOut': {
179
+ args: {
180
+ itemIds: string[];
181
+ frameId?: string;
182
+ };
183
+ result: FrameMoveOutCommand;
184
+ };
185
+ 'frame.autoLayout': {
186
+ args: {
187
+ frameId: string;
188
+ newLayoutInfos?: Record<string, LayoutInfo>;
189
+ };
190
+ result: FrameLayoutCommand;
191
+ };
192
+ 'frame.layoutMode': {
193
+ args: {
194
+ frameId: string;
195
+ targetMode: 'auto' | 'free';
196
+ };
197
+ result: FrameLayoutModeCommand;
198
+ };
199
+ 'selection.set': {
200
+ args: {
201
+ newSelectedIds: string[];
202
+ };
203
+ result: SelectionSetCommand;
204
+ };
205
+ 'page.autoLayout': {
206
+ args: {
207
+ param: PageAutoLayoutParam;
208
+ };
209
+ result: PageAutoLayoutCommand;
210
+ };
211
+ 'viewport.zoom': {
212
+ args: {
213
+ zoomDelta: number;
214
+ center?: Vector2;
215
+ };
216
+ result: ViewportZoomCommand;
217
+ };
218
+ 'viewport.move': {
219
+ args: {
220
+ deltaX: number;
221
+ deltaY: number;
222
+ };
223
+ result: ViewportMoveCommand;
224
+ };
225
+ 'viewport.fitToBox': {
226
+ args: {
227
+ box?: Box2;
228
+ shiftParam?: ViewportFitShiftParam;
229
+ contentRatio?: number;
230
+ };
231
+ result: ViewportFitToBoxCommand;
232
+ };
233
+ 'viewport.fitToItems': {
234
+ args: {
235
+ itemIds?: string[];
236
+ shiftParam?: ViewportFitShiftParam;
237
+ };
238
+ result: ViewportFitToItemsCommand;
239
+ };
240
+ 'scene.switch': {
241
+ args: {
242
+ targetIndex: number;
243
+ };
244
+ result: SceneSwitchCommand;
245
+ };
246
+ }