@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,41 @@
1
+ import type { Command } from '../types';
2
+ import type { Store } from '../../store';
3
+ import type { ItemService } from '../../service';
4
+ export declare enum ReorderType {
5
+ BRING_TO_FRONT = "bringToFront",
6
+ SEND_TO_BACK = "sendToBack",
7
+ MOVE_UP = "moveUp",
8
+ MOVE_DOWN = "moveDown"
9
+ }
10
+ export type ItemReorderCommandArgs = {
11
+ itemId: string;
12
+ reorderType: ReorderType;
13
+ store: Store;
14
+ itemService: ItemService;
15
+ };
16
+ /**
17
+ * item.reorder - 修改元素图层顺序 Command
18
+ *
19
+ * execute/redo: 执行层级变更
20
+ * undo: 恢复原始位置
21
+ */
22
+ export declare class ItemReorderCommand implements Command {
23
+ readonly id: string;
24
+ readonly commandId = "item.reorder";
25
+ private _itemId;
26
+ private _reorderType;
27
+ private _store;
28
+ private _itemService;
29
+ private _oldIndex;
30
+ /**
31
+ * 构造图层顺序调整 Command
32
+ * @param args 包含目标元素 ID、调整类型、Store 与 ItemService
33
+ */
34
+ constructor(args: ItemReorderCommandArgs);
35
+ /** 按调整类型变更元素在列表中的位置并同步渲染顺序 */
36
+ execute(): void;
37
+ /** 撤销:将元素恢复到调整前的位置并同步渲染顺序 */
38
+ undo(): void;
39
+ /** 重做:再次执行层级变更 */
40
+ redo(): void;
41
+ }
@@ -0,0 +1,48 @@
1
+ import type { Command } from '../types';
2
+ import type { ItemService } from '../../service';
3
+ import type { Store } from '../../store';
4
+ export type ItemReplaceSourceCommandArgs = {
5
+ itemId: string;
6
+ /** 新资源 URL(图片/视频/特效) */
7
+ newUrl: string;
8
+ itemService: ItemService;
9
+ store: Store;
10
+ };
11
+ /**
12
+ * item.replaceSource - 静默替换在线资源 Command(**不入 History**;pending 元素复用已有 loading)
13
+ *
14
+ * 自动按元素类型分发:sprite→image、video→video、effects→effects。调用方只传 {itemId,newUrl},
15
+ * 无需关心元素类型,统一一个静默换源入口。
16
+ *
17
+ * **不入 History**:isHistorical=false。静默换源属于资源回流 / 在线热替换,非用户编辑动作,
18
+ * 不该被 undo/redo。undo/redo 实现保留作语义完整,但因不入栈不会被 CommandService 调用。
19
+ *
20
+ * 与 `sprite.image` / `video.source` 的区别:后者入 History 且 execute 走 withLoading 进 loading(gizmo 覆盖);
21
+ * 本命令静默(不经 withLoading)且不入史,适合在线资源热替换 / 本地文件快速替换。
22
+ *
23
+ * execute: 替换为新 URL(auto 状态顺带按新资源原生尺寸收敛)
24
+ *
25
+ * 用法:`artis.command.execute('item.replaceSource', { itemId: id, newUrl })`。失败可经 `artis.item.getLoadError(id)` 观测。
26
+ */
27
+ export declare class ItemReplaceSourceCommand implements Command {
28
+ readonly id: string;
29
+ readonly commandId = "item.replaceSource";
30
+ readonly isHistorical = false;
31
+ readonly params: Record<string, unknown>;
32
+ private _itemId;
33
+ private _newUrl;
34
+ private _oldUrl;
35
+ private _itemService;
36
+ private _store;
37
+ constructor(args: ItemReplaceSourceCommandArgs);
38
+ /** 替换为新资源(async,execute 契约为 void,故 fire-and-forget) */
39
+ execute(): void;
40
+ /** 回退为旧资源 */
41
+ undo(): void;
42
+ /** 重新应用新资源 */
43
+ redo(): void;
44
+ serializeReplay(): {
45
+ args: Record<string, unknown>;
46
+ replayable: false;
47
+ };
48
+ }
@@ -0,0 +1,46 @@
1
+ import type { Command } from '../types';
2
+ import type { ItemService } from '../../service';
3
+ export type ItemSetFontFamilyCommandArgs = {
4
+ itemId: string;
5
+ fontFamily: string;
6
+ fontUrl?: string;
7
+ itemService: ItemService;
8
+ };
9
+ /**
10
+ * item.setFontFamily - 修改文本元素字体 Command
11
+ *
12
+ * 对齐旧版 `setItemFontFamily(id, fontFamilyName, url)`:同时设置 fontFamily 与 fontUrl。
13
+ * fontFamily 通过 ItemService.updateTextContent 同步到 Player TextComponent;
14
+ * fontUrl 仅写入 ArtisItem.property(资源加载由上层保证)。
15
+ *
16
+ * execute/redo: 应用新字体并快照旧值
17
+ * undo: 还原旧 fontFamily / fontUrl
18
+ */
19
+ export declare class ItemSetFontFamilyCommand implements Command {
20
+ readonly id: string;
21
+ readonly commandId = "item.setFontFamily";
22
+ private _itemId;
23
+ private _fontFamily;
24
+ private _fontUrl;
25
+ private _itemService;
26
+ private _oldFontFamily;
27
+ private _oldFontUrl;
28
+ private _captured;
29
+ /**
30
+ * 构造修改字体 Command
31
+ * @param args 包含目标文本元素 ID、新 fontFamily、可选 fontUrl 与 ItemService
32
+ */
33
+ constructor(args: ItemSetFontFamilyCommandArgs);
34
+ /** 应用新字体并首次快照旧值 */
35
+ execute(): void;
36
+ /** 撤销:还原为快照的旧 fontFamily / fontUrl */
37
+ undo(): void;
38
+ /** 重做:再次应用新 fontFamily / fontUrl */
39
+ redo(): void;
40
+ /**
41
+ * 将指定字体应用到目标元素并写入 fontUrl
42
+ * @param fontFamily 新的 fontFamily,为 undefined 则跳过同步
43
+ * @param fontUrl 新的 fontUrl,写入 ArtisItem.property
44
+ */
45
+ private _apply;
46
+ }
@@ -0,0 +1,40 @@
1
+ import type { Command } from '../types';
2
+ import type { ItemService } from '../../service';
3
+ export type ItemSetGeneratorResourceCommandArgs = {
4
+ itemId: string;
5
+ resourceUrl: string;
6
+ itemService: ItemService;
7
+ };
8
+ /**
9
+ * item.setGeneratorResource - 设置生成器资源 Command
10
+ *
11
+ * 对齐旧版 `setGeneratorResource`:generator 元素拿到资源后原地替换为
12
+ * sprite / video 元素(复用同一种子 ID)。
13
+ *
14
+ * execute/redo: 快照原 generator 的 Schema,再转换为目标类型元素,同步重捕真实 id
15
+ * undo: 删除转换后的元素,用快照重建原 generator,同步重捕真实 id
16
+ *
17
+ * id 契约(B + ii):转换后元素 id 由 createItemCore 决定(Artis=schemaId 固定,
18
+ * SceneArtis=instanceId 会变),execute/undo/redo 均同步重捕 _itemId 维系链。
19
+ */
20
+ export declare class ItemSetGeneratorResourceCommand implements Command {
21
+ readonly id: string;
22
+ readonly commandId = "item.setGeneratorResource";
23
+ private _itemId;
24
+ private _resourceUrl;
25
+ private _itemService;
26
+ private _generatorSnapshot;
27
+ /**
28
+ * 构造设置生成器资源 Command
29
+ * @param args 包含目标 generator 元素 ID、资源 URL 与 ItemService
30
+ */
31
+ constructor(args: ItemSetGeneratorResourceCommandArgs);
32
+ /** 快照原 generator Schema 并替换为 sprite/video 元素,同步重捕真实 id */
33
+ execute(): void;
34
+ /** 撤销:删除转换后的元素并用快照重建原 generator,同步重捕真实 id */
35
+ undo(): void;
36
+ /** 重做:再次应用资源转换,同步重捕真实 id */
37
+ redo(): void;
38
+ /** 转换后的元素真实 ID(execute 后同步可用,供 ArtisSDK 同步返回) */
39
+ get currentItemId(): string | undefined;
40
+ }
@@ -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 TransformData = Partial<{
5
+ position: [number, number];
6
+ rotation: number;
7
+ scale: [number, number];
8
+ width: number;
9
+ height: number;
10
+ }>;
11
+ export type ItemTransformCommandArgs = {
12
+ itemId: string;
13
+ newTransform: TransformData;
14
+ itemService: ItemService;
15
+ store: Store;
16
+ };
17
+ /**
18
+ * item.transform - 移动/缩放/旋转 Command
19
+ *
20
+ * execute: 应用新 transform
21
+ * undo: 恢复到旧 transform
22
+ * redo: 重新应用新 transform
23
+ * merge: 支持交互态合并(同一元素连续 transform 变更)
24
+ */
25
+ export declare class ItemTransformCommand implements Command {
26
+ readonly id: string;
27
+ readonly commandId = "item.transform";
28
+ private _itemId;
29
+ private _newTransform;
30
+ private _oldTransform;
31
+ private _itemService;
32
+ private _store;
33
+ /**
34
+ * 构造 transform 变更 Command
35
+ * @param args 包含目标元素 ID、新 transform 数据、ItemService 与 Store
36
+ */
37
+ constructor(args: ItemTransformCommandArgs);
38
+ /** 应用新 transform 并快照旧 transform */
39
+ execute(): void;
40
+ /** 撤销:恢复到快照的旧 transform */
41
+ undo(): void;
42
+ /** 重做:重新应用新 transform */
43
+ redo(): void;
44
+ /**
45
+ * 交互态合并:同一元素的连续 transform 变更合并为一个 Command
46
+ * 保留最初的 oldTransform,更新 newTransform 为最新值。
47
+ * @param other 紧随其后的 Command 实例
48
+ * @returns 合并成功返回 true,否则返回 false
49
+ */
50
+ merge(other: Command): boolean;
51
+ }
@@ -0,0 +1,34 @@
1
+ import type { Command } from '../types';
2
+ import type { ItemService } from '../../service';
3
+ import type { Store } from '../../store';
4
+ export type ItemUngroupCommandArgs = {
5
+ groupId: string;
6
+ itemService: ItemService;
7
+ store: Store;
8
+ };
9
+ /**
10
+ * item.ungroup - 取消打组 Command
11
+ *
12
+ * execute: 删除 Group 元素(保留 children 信息用于 undo)
13
+ * undo: 恢复 Group 元素
14
+ * redo: 再次删除 Group
15
+ */
16
+ export declare class ItemUngroupCommand implements Command {
17
+ readonly id: string;
18
+ readonly commandId = "item.ungroup";
19
+ private _groupId;
20
+ private _itemService;
21
+ private _store;
22
+ private _childrenIds;
23
+ /**
24
+ * 构造取消打组 Command
25
+ * @param args 包含目标 Group 元素 ID、ItemService 与 Store
26
+ */
27
+ constructor(args: ItemUngroupCommandArgs);
28
+ /** 删除 Group 元素并记录原 children 用于撤销 */
29
+ execute(): void;
30
+ /** 撤销:恢复 Group 元素(携带原 children),同步重捕真实 id */
31
+ undo(): void;
32
+ /** 重做:再次删除 Group 元素 */
33
+ redo(): void;
34
+ }
@@ -0,0 +1,41 @@
1
+ import type { Command } from '../types';
2
+ import type { ItemService } from '../../service';
3
+ import type { ItemSchema } from '../../types';
4
+ export type ItemUpdatePropertyBySchemaCommandArgs = {
5
+ schema: ItemSchema | ItemSchema[];
6
+ itemService: ItemService;
7
+ };
8
+ /**
9
+ * item.updatePropertyBySchema - 按 ItemSchema 批量更新元素属性 Command
10
+ *
11
+ * 根据 schema.id 找到已存在元素,用 schema.property 中提供的字段更新属性。
12
+ * 多个元素聚合为一条可撤销命令。
13
+ *
14
+ * execute/redo: 先快照受影响元素的当前 Schema,再应用新属性
15
+ * undo: 用快照的旧 Schema 还原
16
+ */
17
+ export declare class ItemUpdatePropertyBySchemaCommand implements Command {
18
+ readonly id: string;
19
+ readonly commandId = "item.updatePropertyBySchema";
20
+ private _schemas;
21
+ private _itemService;
22
+ private _oldSchemas;
23
+ /**
24
+ * 构造按 Schema 更新属性 Command
25
+ * @param args 包含单个或多个 ItemSchema 与 ItemService
26
+ */
27
+ constructor(args: ItemUpdatePropertyBySchemaCommandArgs);
28
+ /** 快照受影响元素的当前 Schema 并应用新属性 */
29
+ execute(): void;
30
+ /** 撤销:用快照的旧 Schema 还原属性 */
31
+ undo(): void;
32
+ /** 重做:再次应用新 Schema */
33
+ redo(): void;
34
+ /** 同步 Command 契约下观察异步应用失败,并回流统一错误事件。 */
35
+ private _applySchemas;
36
+ /**
37
+ * 快照本次将被修改的所有元素的当前 Schema(仅保留存在的元素)。
38
+ * @returns 受影响元素的当前 Schema 列表
39
+ */
40
+ private _snapshotCurrent;
41
+ }
@@ -0,0 +1,82 @@
1
+ import type { Command } from '../types';
2
+ import type { Store } from '../../store';
3
+ import type { ItemService } from '../../service';
4
+ /**
5
+ * 属性更新支持的 propertyKey 类型
6
+ *
7
+ * Transform 类属性(通过 ItemService.updateItemTransform 同步 Player):
8
+ * - position, rotation, scale, width, height
9
+ *
10
+ * Text 类属性(通过 ItemService.updateTextContent 同步 Player TextComponent):
11
+ * - text, fontSize, fontFamily
12
+ *
13
+ * Sprite 类属性(通过 ItemService.updateSpriteImage 同步 Player SpriteComponent):
14
+ * - image
15
+ *
16
+ * 通用属性(仅修改 ArtisItem.property,不需要同步 Player):
17
+ * - 其他自定义属性
18
+ */
19
+ export type ItemUpdatePropertyCommandArgs = {
20
+ itemId: string;
21
+ propertyKey: string;
22
+ newValue: unknown;
23
+ store: Store;
24
+ itemService: ItemService;
25
+ };
26
+ /**
27
+ * item.updateProperty - 修改元素属性 Command
28
+ *
29
+ * execute/redo: 设置新属性值,并同步到 Player 对应元素
30
+ * undo: 恢复旧属性值,并同步到 Player 对应元素
31
+ * merge: 同一元素同一属性的连续修改可合并
32
+ *
33
+ * 参考旧版 pageDataUtils 中 Operator 的 updatePlayerProperty 逻辑:
34
+ * 不同类型的属性通过不同的 ItemService 方法同步到 Player 层。
35
+ */
36
+ export declare class ItemUpdatePropertyCommand implements Command {
37
+ readonly id: string;
38
+ readonly commandId = "item.updateProperty";
39
+ /**
40
+ * 生命周期事件 payload(由 execute 填充,供 CommandService.onCommandLifecycle
41
+ * 中央监听在 undo/redo 时从实例读取;工厂此时已退场)。
42
+ */
43
+ eventPayload?: Record<string, unknown>;
44
+ private _itemId;
45
+ private _propertyKey;
46
+ private _newValue;
47
+ private _oldValue;
48
+ private _store;
49
+ private _itemService;
50
+ /**
51
+ * 构造属性更新 Command
52
+ * @param args 包含目标元素 ID、属性 key、新值、Store 与 ItemService
53
+ */
54
+ constructor(args: ItemUpdatePropertyCommandArgs);
55
+ /** 设置新属性值并同步到 Player(拦截非法 layoutMode 修改) */
56
+ execute(): void;
57
+ /** 撤销:恢复旧属性值并同步到 Player */
58
+ undo(): void;
59
+ /** 重做:重新应用新属性值并同步到 Player */
60
+ redo(): void;
61
+ /**
62
+ * 同一元素同一属性的连续修改可合并。
63
+ * @param other 紧随其后的 Command 实例
64
+ * @returns 合并成功返回 true,否则返回 false
65
+ */
66
+ merge(other: Command): boolean;
67
+ /**
68
+ * 获取目标属性的当前值。
69
+ * @returns 当前属性值,元素不存在时返回 undefined
70
+ */
71
+ private getPropertyValue;
72
+ /**
73
+ * 应用属性值并同步到 Player
74
+ * 参考旧版 Operator 的分发逻辑:
75
+ * - Transform 属性 → ItemService.updateItemTransform(同步 VFXItem.transform)
76
+ * - Text 属性 → ItemService.updateTextContent(同步 TextComponent)
77
+ * - image 属性 → ItemService.updateSpriteImage(同步 SpriteComponent)
78
+ * - 其他属性 → 仅写入 ArtisItem.property
79
+ * @param value 待应用的新属性值
80
+ */
81
+ private applyValue;
82
+ }
@@ -0,0 +1,53 @@
1
+ import type { Command } from '../types';
2
+ /**
3
+ * Mask 笔画线段数据
4
+ */
5
+ export type MaskLine = {
6
+ points: [number, number][];
7
+ brushSize: number;
8
+ isEraser: boolean;
9
+ /**
10
+ * 形状类型:'stroke' 折线(默认),'rect' 矩形框选(points=[起点, 终点] 归一化)。
11
+ * 透传该字段以保证 undo/redo 时 rect 笔画不退化为 2 点折线。
12
+ */
13
+ shape?: 'stroke' | 'rect';
14
+ };
15
+ export type MaskCommitCommandArgs = {
16
+ /** 当前交互产生的新笔画 */
17
+ newLines: MaskLine[];
18
+ /** 交互前的所有笔画 */
19
+ oldLines: MaskLine[];
20
+ /** 交互后的贴图快照(base64 或像素数据) */
21
+ newTextureSnapshot: string;
22
+ /** 交互前的贴图快照 */
23
+ oldTextureSnapshot: string;
24
+ /** 应用 mask 状态的回调 */
25
+ applyMask: (lines: MaskLine[], textureSnapshot: string) => void;
26
+ };
27
+ /**
28
+ * mask.commit - 提交 Mask 区域 Command
29
+ *
30
+ * execute: 应用新的 mask 笔画 + 贴图
31
+ * undo: 恢复到交互前的笔画 + 贴图
32
+ * redo: 重新应用新的笔画 + 贴图
33
+ */
34
+ export declare class MaskCommitCommand implements Command {
35
+ readonly id: string;
36
+ readonly commandId = "mask.commit";
37
+ private _newLines;
38
+ private _oldLines;
39
+ private _newTextureSnapshot;
40
+ private _oldTextureSnapshot;
41
+ private _applyMask;
42
+ /**
43
+ * 构造 Mask 提交 Command
44
+ * @param args 包含新旧笔画、新旧贴图快照与 applyMask 回调
45
+ */
46
+ constructor(args: MaskCommitCommandArgs);
47
+ /** 应用新的 mask 笔画与贴图 */
48
+ execute(): void;
49
+ /** 撤销:恢复到交互前的笔画与贴图 */
50
+ undo(): void;
51
+ /** 重做:重新应用新的笔画与贴图 */
52
+ redo(): void;
53
+ }
@@ -0,0 +1,53 @@
1
+ import type { Command } from '../types';
2
+ import type { ItemService } from '../../service';
3
+ import type { Store } from '../../store';
4
+ import type { PageAutoLayoutParam } from '../../types';
5
+ export type PageAutoLayoutCommandArgs = {
6
+ param: PageAutoLayoutParam;
7
+ itemService: ItemService;
8
+ store: Store;
9
+ };
10
+ /**
11
+ * page.autoLayout - 页面自动排布 Command
12
+ *
13
+ * execute: 记录所有受影响元素的旧 position,再执行自动排布
14
+ * undo: 把受影响元素的 position 恢复到排布前
15
+ * redo: 重新执行自动排布
16
+ *
17
+ * 说明:自动排布仅改变元素 position(不改尺寸/旋转),因此只需记录并恢复 position 即可。
18
+ * 视口 fitToBox 不属于数据变更,不纳入撤销范围。
19
+ */
20
+ export declare class PageAutoLayoutCommand implements Command {
21
+ readonly id: string;
22
+ readonly commandId = "page.autoLayout";
23
+ private _param;
24
+ private _itemService;
25
+ private _store;
26
+ private _oldPositions;
27
+ /**
28
+ * 构造页面自动排布命令,缓存参数与上下文
29
+ * @param args 命令参数(含排布配置、ItemService、Store)
30
+ */
31
+ constructor(args: PageAutoLayoutCommandArgs);
32
+ /**
33
+ * 首次执行时记录顶层元素旧 position,再执行自动排布
34
+ */
35
+ execute(): void;
36
+ /**
37
+ * 将受影响元素的 position 恢复到排布前;无快照时不操作
38
+ */
39
+ undo(): void;
40
+ /**
41
+ * 重新执行自动排布
42
+ */
43
+ redo(): void;
44
+ /**
45
+ * 收集所有顶层元素(无 parentId)的当前 position 作为撤销快照。
46
+ *
47
+ * 与 ItemService.autoLayoutPage 的参与范围保持一致:
48
+ * - 指定 ids 时仅记录这些元素
49
+ * - 否则记录全部顶层元素
50
+ * @returns 顶层元素 id 到其 position 的快照映射
51
+ */
52
+ private _collectTopLevelPositions;
53
+ }
@@ -0,0 +1,43 @@
1
+ import type { Command } from '../types';
2
+ /**
3
+ * 归一化包围盒(0~1 范围)
4
+ */
5
+ export type NormalizedBox = {
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ };
11
+ export type PictureCutCommitCommandArgs = {
12
+ /** 新的裁切包围盒 */
13
+ newBox: NormalizedBox;
14
+ /** 交互前的裁切包围盒 */
15
+ oldBox: NormalizedBox;
16
+ /** 应用裁切区域的回调 */
17
+ applyBox: (box: NormalizedBox) => void;
18
+ };
19
+ /**
20
+ * pictureCut.commit - 提交裁切区域 Command
21
+ *
22
+ * execute: 应用新的裁切包围盒
23
+ * undo: 恢复到交互前的裁切包围盒
24
+ * redo: 重新应用新的裁切包围盒
25
+ */
26
+ export declare class PictureCutCommitCommand implements Command {
27
+ readonly id: string;
28
+ readonly commandId = "pictureCut.commit";
29
+ private _newBox;
30
+ private _oldBox;
31
+ private _applyBox;
32
+ /**
33
+ * 构造裁切提交命令,缓存新旧包围盒与应用回调
34
+ * @param args 命令参数(含新旧裁切包围盒与 applyBox 回调)
35
+ */
36
+ constructor(args: PictureCutCommitCommandArgs);
37
+ /** 应用新的裁切包围盒 */
38
+ execute(): void;
39
+ /** 恢复到交互前的裁切包围盒 */
40
+ undo(): void;
41
+ /** 重新应用新的裁切包围盒 */
42
+ redo(): void;
43
+ }
@@ -0,0 +1,35 @@
1
+ import type { Command } from '../types';
2
+ import type { NormalizedBox } from './picture-cut-commit-command';
3
+ export type PictureExpandCommitCommandArgs = {
4
+ /** 新的扩图包围盒 */
5
+ newBox: NormalizedBox;
6
+ /** 交互前的扩图包围盒 */
7
+ oldBox: NormalizedBox;
8
+ /** 应用扩图区域的回调 */
9
+ applyBox: (box: NormalizedBox) => void;
10
+ };
11
+ /**
12
+ * pictureExpand.commit - 提交扩图区域 Command
13
+ *
14
+ * execute: 应用新的扩图包围盒
15
+ * undo: 恢复到交互前的扩图包围盒
16
+ * redo: 重新应用新的扩图包围盒
17
+ */
18
+ export declare class PictureExpandCommitCommand implements Command {
19
+ readonly id: string;
20
+ readonly commandId = "pictureExpand.commit";
21
+ private _newBox;
22
+ private _oldBox;
23
+ private _applyBox;
24
+ /**
25
+ * 构造扩图提交命令,缓存新旧包围盒与应用回调
26
+ * @param args 命令参数(含新旧扩图包围盒与 applyBox 回调)
27
+ */
28
+ constructor(args: PictureExpandCommitCommandArgs);
29
+ /** 应用新的扩图包围盒 */
30
+ execute(): void;
31
+ /** 恢复到交互前的扩图包围盒 */
32
+ undo(): void;
33
+ /** 重新应用新的扩图包围盒 */
34
+ redo(): void;
35
+ }
@@ -0,0 +1,35 @@
1
+ import type { Command } from '../types';
2
+ export type SceneSwitchCommandArgs = {
3
+ /** 目标场景索引 */
4
+ targetIndex: number;
5
+ /** 切换前场景索引 */
6
+ previousIndex: number;
7
+ /** 执行场景切换的回调(由外部使用者提供) */
8
+ applySwitchScene: (index: number) => Promise<void>;
9
+ };
10
+ /**
11
+ * SceneSwitchCommand - 场景切换命令
12
+ *
13
+ * 将场景切换纳入共享历史栈,支持 undo/redo:
14
+ * - execute/redo:切换到目标场景
15
+ * - undo:切回上一个场景
16
+ *
17
+ * 注意:applySwitchScene 是异步的,但 Command 接口为同步,
18
+ * 通过 void 触发异步操作(fire-and-forget)。
19
+ */
20
+ export declare class SceneSwitchCommand implements Command {
21
+ readonly id: string;
22
+ readonly commandId = "scene.switch";
23
+ private _args;
24
+ /**
25
+ * 构造场景切换命令,缓存切换参数与回调
26
+ * @param args 命令参数(含目标/原场景索引与 applySwitchScene 回调)
27
+ */
28
+ constructor(args: SceneSwitchCommandArgs);
29
+ /** 异步切换到目标场景(fire-and-forget) */
30
+ execute(): void;
31
+ /** 异步切回上一个场景(fire-and-forget) */
32
+ undo(): void;
33
+ /** 重新切换到目标场景 */
34
+ redo(): void;
35
+ }
@@ -0,0 +1,38 @@
1
+ import type { Command } from '../types';
2
+ export type SelectionSetCommandArgs = {
3
+ newSelectedIds: string[];
4
+ oldSelectedIds: string[];
5
+ applySelection: (ids: string[]) => void;
6
+ };
7
+ /**
8
+ * selection.set - 设置/清空选中元素 Command
9
+ *
10
+ * execute: 设置新的选中元素
11
+ * undo: 恢复上一次选中状态
12
+ * redo: 重新设置选中元素
13
+ * merge: 连续选中操作合并(保留最初 old,更新 new)
14
+ */
15
+ export declare class SelectionSetCommand implements Command {
16
+ readonly id: string;
17
+ readonly commandId = "selection.set";
18
+ private _newSelectedIds;
19
+ private _oldSelectedIds;
20
+ private _applySelection;
21
+ /**
22
+ * 构造选中设置命令,缓存新旧选中 id 与应用回调
23
+ * @param args 命令参数(含新旧选中 id 列表与 applySelection 回调)
24
+ */
25
+ constructor(args: SelectionSetCommandArgs);
26
+ /** 设置新的选中元素 */
27
+ execute(): void;
28
+ /** 恢复上一次选中状态 */
29
+ undo(): void;
30
+ /** 重新设置选中元素 */
31
+ redo(): void;
32
+ /**
33
+ * 与同类型后续选中命令合并:保留最初 old,更新 new
34
+ * @param other 紧随其后的命令
35
+ * @returns 合并成功返回 true,否则 false
36
+ */
37
+ merge(other: Command): boolean;
38
+ }