@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.
- package/LICENSE +22 -0
- package/dist/artis/artis.d.ts +44 -0
- package/dist/artis/base-artis.d.ts +520 -0
- package/dist/artis/canvas-layer-order.d.ts +19 -0
- package/dist/artis/create-info-to-schema.d.ts +21 -0
- package/dist/artis/index.d.ts +15 -0
- package/dist/artis/operations/index.d.ts +3 -0
- package/dist/artis/operations/operations.d.ts +362 -0
- package/dist/artis/operations/scene-operations.d.ts +26 -0
- package/dist/artis/operations/types.d.ts +39 -0
- package/dist/artis/scene-artis.d.ts +386 -0
- package/dist/artis/screenshot-service.d.ts +83 -0
- package/dist/artis/types.d.ts +130 -0
- package/dist/artis/wiring/index.d.ts +17 -0
- package/dist/artis/wiring/register-commands.d.ts +44 -0
- package/dist/artis/wiring/setup-commands.d.ts +5 -0
- package/dist/artis/wiring/setup-event-bindings.d.ts +16 -0
- package/dist/artis/wiring/setup-keybindings.d.ts +38 -0
- package/dist/artis/wiring/setup-plugins.d.ts +5 -0
- package/dist/artis/wiring/wiring-context.d.ts +34 -0
- package/dist/artis-sdk/artis-sdk.d.ts +1117 -0
- package/dist/artis-sdk/index.d.ts +1 -0
- package/dist/core/asset/asset-manager.d.ts +288 -0
- package/dist/core/asset/index.d.ts +3 -0
- package/dist/core/command/command-service.d.ts +315 -0
- package/dist/core/command/commands/composite-command.d.ts +45 -0
- package/dist/core/command/commands/frame-layout-command.d.ts +81 -0
- package/dist/core/command/commands/frame-layout-mode-command.d.ts +55 -0
- package/dist/core/command/commands/frame-move-in-command.d.ts +54 -0
- package/dist/core/command/commands/frame-move-out-command.d.ts +54 -0
- package/dist/core/command/commands/group-children-detach-command.d.ts +28 -0
- package/dist/core/command/commands/index.d.ts +98 -0
- package/dist/core/command/commands/item-align-command.d.ts +52 -0
- package/dist/core/command/commands/item-create-command.d.ts +66 -0
- package/dist/core/command/commands/item-delete-command.d.ts +40 -0
- package/dist/core/command/commands/item-distribute-command.d.ts +53 -0
- package/dist/core/command/commands/item-group-command.d.ts +41 -0
- package/dist/core/command/commands/item-reorder-command.d.ts +41 -0
- package/dist/core/command/commands/item-replace-source-command.d.ts +48 -0
- package/dist/core/command/commands/item-set-font-family-command.d.ts +46 -0
- package/dist/core/command/commands/item-set-generator-resource-command.d.ts +40 -0
- package/dist/core/command/commands/item-transform-command.d.ts +51 -0
- package/dist/core/command/commands/item-ungroup-command.d.ts +34 -0
- package/dist/core/command/commands/item-update-property-by-create-info-command.d.ts +41 -0
- package/dist/core/command/commands/item-update-property-command.d.ts +82 -0
- package/dist/core/command/commands/mask-commit-command.d.ts +53 -0
- package/dist/core/command/commands/page-auto-layout-command.d.ts +53 -0
- package/dist/core/command/commands/picture-cut-commit-command.d.ts +43 -0
- package/dist/core/command/commands/picture-expand-commit-command.d.ts +35 -0
- package/dist/core/command/commands/scene-switch-command.d.ts +35 -0
- package/dist/core/command/commands/selection-set-command.d.ts +38 -0
- package/dist/core/command/commands/sprite-image-command.d.ts +36 -0
- package/dist/core/command/commands/sprite-text-edit-commit-command.d.ts +43 -0
- package/dist/core/command/commands/state-hand-command.d.ts +14 -0
- package/dist/core/command/commands/state-image-cut-command.d.ts +14 -0
- package/dist/core/command/commands/state-image-expand-command.d.ts +14 -0
- package/dist/core/command/commands/state-image-mask-command.d.ts +15 -0
- package/dist/core/command/commands/state-image-text-edit-command.d.ts +14 -0
- package/dist/core/command/commands/state-item-create-command.d.ts +34 -0
- package/dist/core/command/commands/state-move-command.d.ts +14 -0
- package/dist/core/command/commands/state-switch-command-base.d.ts +41 -0
- package/dist/core/command/commands/text-move-command.d.ts +47 -0
- package/dist/core/command/commands/text-rotate-command.d.ts +52 -0
- package/dist/core/command/commands/text-scale-command.d.ts +56 -0
- package/dist/core/command/commands/text-update-content-command.d.ts +51 -0
- package/dist/core/command/commands/transform-move-command.d.ts +56 -0
- package/dist/core/command/commands/transform-move-with-frame-change-command.d.ts +80 -0
- package/dist/core/command/commands/transform-move-with-layout-command.d.ts +56 -0
- package/dist/core/command/commands/transform-rotate-command.d.ts +51 -0
- package/dist/core/command/commands/transform-scale-command.d.ts +54 -0
- package/dist/core/command/commands/video-play-command.d.ts +28 -0
- package/dist/core/command/commands/video-source-command.d.ts +39 -0
- package/dist/core/command/commands/viewport-fit-to-box-command.d.ts +37 -0
- package/dist/core/command/commands/viewport-fit-to-items-command.d.ts +43 -0
- package/dist/core/command/commands/viewport-move-command.d.ts +34 -0
- package/dist/core/command/commands/viewport-zoom-command.d.ts +35 -0
- package/dist/core/command/index.d.ts +5 -0
- package/dist/core/command/registry.d.ts +246 -0
- package/dist/core/command/types.d.ts +124 -0
- package/dist/core/element-registry/element-facade.d.ts +35 -0
- package/dist/core/element-registry/element-identity-strategy.d.ts +75 -0
- package/dist/core/element-registry/element-registry.d.ts +72 -0
- package/dist/core/element-registry/index.d.ts +5 -0
- package/dist/core/element-registry/types.d.ts +15 -0
- package/dist/core/gizmo/gizmo-bootstrap.d.ts +70 -0
- package/dist/core/gizmo/gizmo-command-binder.d.ts +55 -0
- package/dist/core/gizmo/gizmo-config-override.d.ts +24 -0
- package/dist/core/gizmo/gizmo-registry.d.ts +39 -0
- package/dist/core/gizmo/index.d.ts +19 -0
- package/dist/core/gizmo/register-gizmo-command-bindings.d.ts +20 -0
- package/dist/core/gizmo/state-gizmo-controller.d.ts +20 -0
- package/dist/core/history/history-manager.d.ts +174 -0
- package/dist/core/history/index.d.ts +1 -0
- package/dist/core/index.d.ts +25 -0
- package/dist/core/item/base-item.d.ts +154 -0
- package/dist/core/item/card-item.d.ts +91 -0
- package/dist/core/item/default-item-schema.d.ts +20 -0
- package/dist/core/item/effects-item.d.ts +99 -0
- package/dist/core/item/frame-item.d.ts +153 -0
- package/dist/core/item/generator-item.d.ts +114 -0
- package/dist/core/item/group-item.d.ts +51 -0
- package/dist/core/item/index.d.ts +25 -0
- package/dist/core/item/sprite-item.d.ts +80 -0
- package/dist/core/item/text-item.d.ts +171 -0
- package/dist/core/item/types.d.ts +158 -0
- package/dist/core/item/video-item.d.ts +120 -0
- package/dist/core/keybinding/index.d.ts +11 -0
- package/dist/core/keybinding/key-binding-controller.d.ts +44 -0
- package/dist/core/keybinding/key-binding-registry.d.ts +92 -0
- package/dist/core/keybinding/key-binding-store.d.ts +29 -0
- package/dist/core/keybinding/key-matcher.d.ts +24 -0
- package/dist/core/keybinding/types.d.ts +84 -0
- package/dist/core/plugin/index.d.ts +3 -0
- package/dist/core/plugin/io-plugin.d.ts +167 -0
- package/dist/core/plugin/plugin-system.d.ts +77 -0
- package/dist/core/predict/align-predict.d.ts +20 -0
- package/dist/core/predict/base/box-ops.d.ts +40 -0
- package/dist/core/predict/base/index.d.ts +14 -0
- package/dist/core/predict/base/parent-coord.d.ts +29 -0
- package/dist/core/predict/base/schema-box.d.ts +21 -0
- package/dist/core/predict/distribute-predict.d.ts +19 -0
- package/dist/core/predict/frame-layout-predict.d.ts +24 -0
- package/dist/core/predict/index.d.ts +12 -0
- package/dist/core/preferences/index.d.ts +2 -0
- package/dist/core/preferences/user-preferences-manager.d.ts +130 -0
- package/dist/core/quality/error-monitor/error-monitor-facade.d.ts +73 -0
- package/dist/core/quality/error-monitor/error-monitor.d.ts +106 -0
- package/dist/core/quality/error-monitor/index.d.ts +4 -0
- package/dist/core/quality/error-monitor/types.d.ts +198 -0
- package/dist/core/quality/index.d.ts +3 -0
- package/dist/core/quality/perf-monitor/index.d.ts +5 -0
- package/dist/core/quality/perf-monitor/perf-monitor-facade.d.ts +45 -0
- package/dist/core/quality/perf-monitor/perf-monitor.d.ts +60 -0
- package/dist/core/quality/perf-monitor/types.d.ts +66 -0
- package/dist/core/quality/stability-monitor/index.d.ts +5 -0
- package/dist/core/quality/stability-monitor/stability-monitor-facade.d.ts +50 -0
- package/dist/core/quality/stability-monitor/stability-monitor.d.ts +61 -0
- package/dist/core/quality/stability-monitor/types.d.ts +69 -0
- package/dist/core/renderer/background-controller.d.ts +56 -0
- package/dist/core/renderer/index.d.ts +5 -0
- package/dist/core/renderer/player-adapter.d.ts +129 -0
- package/dist/core/renderer/renderer.d.ts +134 -0
- package/dist/core/service/frame-service.d.ts +116 -0
- package/dist/core/service/index.d.ts +9 -0
- package/dist/core/service/interaction-providers.d.ts +20 -0
- package/dist/core/service/interaction-service.d.ts +211 -0
- package/dist/core/service/item-asset-service.d.ts +120 -0
- package/dist/core/service/item-creator-service.d.ts +211 -0
- package/dist/core/service/item-service.d.ts +641 -0
- package/dist/core/service/item-sync-service.d.ts +66 -0
- package/dist/core/service/json-scene-sync-service.d.ts +140 -0
- package/dist/core/service/refresh-animation-base-service.d.ts +1 -0
- package/dist/core/service/scene-data-assembler.d.ts +166 -0
- package/dist/core/service/view-service.d.ts +202 -0
- package/dist/core/state/base-state.d.ts +28 -0
- package/dist/core/state/index.d.ts +6 -0
- package/dist/core/state/presets.d.ts +25 -0
- package/dist/core/state/state-manager.d.ts +50 -0
- package/dist/core/state/types.d.ts +52 -0
- package/dist/core/store/index.d.ts +3 -0
- package/dist/core/store/scene-store.d.ts +194 -0
- package/dist/core/store/store.d.ts +36 -0
- package/dist/core/types/artis-config.d.ts +186 -0
- package/dist/core/types/artis-events.d.ts +101 -0
- package/dist/core/types/frame.d.ts +3 -0
- package/dist/core/types/generator.d.ts +28 -0
- package/dist/core/types/index.d.ts +15 -0
- package/dist/core/types/item-create-info.d.ts +205 -0
- package/dist/core/types/item-property.d.ts +149 -0
- package/dist/core/types/item-reorder.d.ts +12 -0
- package/dist/core/types/item-schema.d.ts +263 -0
- package/dist/core/types/item-set-property.d.ts +48 -0
- package/dist/core/types/page.d.ts +40 -0
- package/dist/core/types/sdk.d.ts +28 -0
- package/dist/core/types/view.d.ts +39 -0
- package/dist/helper/exporter/config.d.ts +18 -0
- package/dist/helper/exporter/const.d.ts +71 -0
- package/dist/helper/exporter/export-media.d.ts +189 -0
- package/dist/helper/exporter/exporter.d.ts +58 -0
- package/dist/helper/exporter/index.d.ts +2 -0
- package/dist/helper/exporter/types.d.ts +194 -0
- package/dist/helper/exporter/utils.d.ts +71 -0
- package/dist/helper/exporter/wav-audio.d.ts +35 -0
- package/dist/helper/html-overlay/anchor-navigation-runtime.d.ts +1 -0
- package/dist/helper/html-overlay/auto-height-layout.d.ts +16 -0
- package/dist/helper/html-overlay/auto-height-runtime.d.ts +40 -0
- package/dist/helper/html-overlay/document-runtime.d.ts +18 -0
- package/dist/helper/html-overlay/document-transform.d.ts +46 -0
- package/dist/helper/html-overlay/dom-order.d.ts +5 -0
- package/dist/helper/html-overlay/host-message-runtime.d.ts +15 -0
- package/dist/helper/html-overlay/html-capture-runtime.d.ts +12 -0
- package/dist/helper/html-overlay/html-card-service.d.ts +287 -0
- package/dist/helper/html-overlay/html-viewport-style.d.ts +6 -0
- package/dist/helper/html-overlay/index.d.ts +1 -0
- package/dist/helper/html-overlay/inline-script-json.d.ts +1 -0
- package/dist/helper/html-overlay/mime-utils.d.ts +13 -0
- package/dist/helper/html-overlay/overlay-transform.d.ts +30 -0
- package/dist/helper/html-overlay/path-utils.d.ts +34 -0
- package/dist/helper/html-overlay/runtime-context.d.ts +2 -0
- package/dist/helper/html-overlay/shell-runtime.d.ts +13 -0
- package/dist/helper/index.d.ts +5 -0
- package/dist/helper/scene-builder.d.ts +111 -0
- package/dist/helper/screen-shot.d.ts +51 -0
- package/dist/helper/size-adapt.d.ts +88 -0
- package/dist/index.cjs +69350 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.mjs +68963 -0
- package/dist/index.mjs.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/player.d.ts +9 -0
- package/dist/utils/background-manager.d.ts +76 -0
- package/dist/utils/common-utils.d.ts +39 -0
- package/dist/utils/container-size.d.ts +7 -0
- package/dist/utils/find-player-item.d.ts +9 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/json-data-utils.d.ts +198 -0
- package/dist/utils/layout-utils.d.ts +144 -0
- package/dist/utils/pixel-box-utils.d.ts +26 -0
- package/dist/utils/player-data-utils.d.ts +9 -0
- package/dist/utils/player-utils.d.ts +42 -0
- package/dist/utils/replay-utils.d.ts +22 -0
- package/dist/utils/types.d.ts +130 -0
- package/package.json +66 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command - 指令接口
|
|
3
|
+
*
|
|
4
|
+
* 所有涉及数据变换的操作都封装为 Command,支持:
|
|
5
|
+
* 1. 执行 (execute) - 修改数据并完成回调
|
|
6
|
+
* 2. 撤销 (undo) - 恢复到执行前的状态
|
|
7
|
+
* 3. 重做 (redo) - 默认等于再次执行
|
|
8
|
+
* 4. 交互态合并 (merge) - 连续拖拽时合并为一个 Command,交互结束后再入 History
|
|
9
|
+
*/
|
|
10
|
+
export type Command = {
|
|
11
|
+
/** Command 唯一标识(如 'item.create_1716000000') */
|
|
12
|
+
readonly id: string;
|
|
13
|
+
/** Command 类型 ID(如 'item.create') */
|
|
14
|
+
readonly commandId: string;
|
|
15
|
+
/**
|
|
16
|
+
* 是否入历史栈(默认 true 入栈,可 undo/redo)。
|
|
17
|
+
*
|
|
18
|
+
* 设为 false 的 Command(如静默资源热替换 `item.replaceSource`)经 CommandService 执行后
|
|
19
|
+
* 不进入 History——它是资源回流/在线热替换,非用户编辑动作,不该被 undo/redo。
|
|
20
|
+
* 判断收口在 {@link CommandService._pushToHistory} 咽喉处,所有入史路径(execute/record/batch)
|
|
21
|
+
* 统一尊重。缺省 true 保持既有命令行为不变。
|
|
22
|
+
*/
|
|
23
|
+
readonly isHistorical?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Command 执行时携带的关键参数(可选)。
|
|
26
|
+
* 各具体 Command 实现可将关键入参赋值到此字段,用于错误上报时携带操作上下文。
|
|
27
|
+
* 未赋值时默认为空对象,不影响 execute / undo / redo 逻辑。
|
|
28
|
+
*/
|
|
29
|
+
params?: Record<string, unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* 可重放信息(可选,由 CommandService 在入 History 咽喉处统一填充)。
|
|
32
|
+
* args: 该命令的纯数据重建入参(对象 key-value,JSON-safe);replayable: 是否完整可重放。
|
|
33
|
+
* 用于错误上报快照,使复现页能按 commandId + args 正向重放该指令。
|
|
34
|
+
* 不影响 execute / undo / redo 逻辑。
|
|
35
|
+
*
|
|
36
|
+
* args 为**单参对象**(破坏性变更:原按位置数组);与命令对外 args 形状同源(同一组具名字段),
|
|
37
|
+
* 由 {@link ./registry.ts | CommandRegistry} 经重载反推类型。对象 key 比位置数组更适合 replay
|
|
38
|
+
* 收集/解构(无下标约定耦合)。
|
|
39
|
+
*/
|
|
40
|
+
replay?: {
|
|
41
|
+
args: Record<string, unknown>;
|
|
42
|
+
replayable: boolean;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* 外部事件 payload(可选,纯数据,由各 Command 在 execute 时自填)。
|
|
46
|
+
*
|
|
47
|
+
* 供 {@link CommandService.onCommandLifecycle} 中央监听统一读取:undo/redo 时调用方
|
|
48
|
+
* 工厂已退场,只有实例上的 payload 可读。各 Command 视需要填充业务上下文(如 itemId/
|
|
49
|
+
* propertyKey/newValue/oldValue);未填则 lifecycle 事件 payload 为 undefined,不影响
|
|
50
|
+
* execute/undo/redo 逻辑。纯数据(不含服务引用/函数),可随 replay 序列化。
|
|
51
|
+
*/
|
|
52
|
+
eventPayload?: Record<string, unknown>;
|
|
53
|
+
/**
|
|
54
|
+
* 命令自序列化为可重放入参(可选)。
|
|
55
|
+
*
|
|
56
|
+
* 各 Command 可视情况实现:返回**纯数据**重建入参(不含 ItemService/Store 等服务引用),
|
|
57
|
+
* 由 CommandService 在统一咽喉(history.push)处调用并缓存到 {@link replay}。
|
|
58
|
+
* 未实现时该命令在快照中标 replayable=false(复现页跳过执行,仅展示上报时态)。
|
|
59
|
+
*
|
|
60
|
+
* 注意:含函数入参(如 viewport.zoom 的 applyZoom)或非 JSON-safe 类实例的命令
|
|
61
|
+
* 应返回 replayable=false,避免重放时崩在方法丢失上。
|
|
62
|
+
*/
|
|
63
|
+
serializeReplay?(): {
|
|
64
|
+
args: Record<string, unknown>;
|
|
65
|
+
replayable: boolean;
|
|
66
|
+
};
|
|
67
|
+
/** 执行数据修改 */
|
|
68
|
+
execute(): void;
|
|
69
|
+
/** 撤销操作,恢复数据到执行前 */
|
|
70
|
+
undo(): void;
|
|
71
|
+
/** 重做操作,默认实现等于 execute */
|
|
72
|
+
redo(): void;
|
|
73
|
+
/**
|
|
74
|
+
* 交互态合并:判断是否可以与另一个同类型 Command 合并
|
|
75
|
+
* 返回 true 表示成功合并(当前 Command 已吸收 other 的变更)
|
|
76
|
+
*
|
|
77
|
+
* @param other 待合并的另一 Command
|
|
78
|
+
* @returns 是否合并成功
|
|
79
|
+
*/
|
|
80
|
+
merge?(other: Command): boolean;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* CommandFactory - Command 工厂函数
|
|
84
|
+
* 注册时提供,执行时由 CommandService 调用来创建 Command 实例
|
|
85
|
+
*
|
|
86
|
+
* 入参为<b>单参对象</b>(破坏性变更:原位置数组 `...args: unknown[]`)。泛型 `A` 即命令对外暴露的
|
|
87
|
+
* 入参对象形状,由 {@link ./registry.ts | CommandRegistry} 经 `registerCommand`/`execute` 四入口
|
|
88
|
+
* 重载反推;外部自定义命令可经 `registerCommand<A>` 显式/隐式填充,缺省 `unknown`。工厂体可
|
|
89
|
+
* spread 透传 `new XxxCommand({ ...args, deps })`。
|
|
90
|
+
*/
|
|
91
|
+
export type CommandFactory<A = unknown> = (args: A) => Command;
|
|
92
|
+
/**
|
|
93
|
+
* 历史记录操作方向
|
|
94
|
+
*
|
|
95
|
+
* - undo / redo / push 携带对应 Command(push 为刚入栈的命令)
|
|
96
|
+
* - session(pushSession/popSession 栈切换)/ clear(清空)无具体 Command,command 缺省
|
|
97
|
+
*/
|
|
98
|
+
export type HistoryOperation = {
|
|
99
|
+
type: 'push' | 'undo' | 'redo' | 'session' | 'clear';
|
|
100
|
+
command?: Command;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Command 生命周期事件触发时机(中央监听)。
|
|
104
|
+
*
|
|
105
|
+
* - execute:命令正向执行(含 batch endBatch 聚合后的代表命令)
|
|
106
|
+
* - undo:历史撤销
|
|
107
|
+
* - redo:历史重做
|
|
108
|
+
*/
|
|
109
|
+
export type CommandPhase = 'execute' | 'undo' | 'redo';
|
|
110
|
+
/**
|
|
111
|
+
* Command 生命周期事件(由 {@link CommandService.onCommandLifecycle} 统一发出)。
|
|
112
|
+
*
|
|
113
|
+
* 横切订阅(埋点/自动保存/UI 刷新触发)经此一处即可覆盖 execute/undo/redo 全生命周期,
|
|
114
|
+
* 不必分别订阅 afterExecute(execute 侧) 与 history.setOnChange(undo/redo 侧)。
|
|
115
|
+
*
|
|
116
|
+
* - phase:触发时机
|
|
117
|
+
* - command:来源 Command 实例(undo/redo 时为 history 持有的同一实例)
|
|
118
|
+
* - payload:Command 自填的 {@link Command.eventPayload},未填则 undefined
|
|
119
|
+
*/
|
|
120
|
+
export type CommandLifecycleEvent = {
|
|
121
|
+
phase: CommandPhase;
|
|
122
|
+
command: Command;
|
|
123
|
+
payload?: Record<string, unknown>;
|
|
124
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ArtisItem } from '../item';
|
|
2
|
+
import type { ItemSchema } from '../types';
|
|
3
|
+
import type { ItemService } from '../service';
|
|
4
|
+
/**
|
|
5
|
+
* artis.element 对外门面(决策 D3/D4)
|
|
6
|
+
*
|
|
7
|
+
* 对外统一入口:所有入参/出参仅见元素ID(D4),**不暴露 vfxItemId**。
|
|
8
|
+
* 内部委托 ItemService 既有方法,不重写 CRUD——门面只做「按元素ID 的稳定入口 + 委托」。
|
|
9
|
+
*
|
|
10
|
+
* 与 {@link ItemService} 的区别:ItemService 是底层服务(含 vfxItemId 等内部细节),
|
|
11
|
+
* 本门面只暴露以元素ID 为语义的稳定 API,供业务侧使用。
|
|
12
|
+
*/
|
|
13
|
+
export declare class ElementFacade {
|
|
14
|
+
private readonly _itemService;
|
|
15
|
+
constructor(itemService: ItemService);
|
|
16
|
+
/** 按元素ID 取 ArtisItem;不存在时返回 undefined */
|
|
17
|
+
get(id: string): ArtisItem | undefined;
|
|
18
|
+
/** 批量按元素ID 取 ArtisItem;跳过不存在的 id */
|
|
19
|
+
getMany(ids: string[]): ArtisItem[];
|
|
20
|
+
/** 批量取 Schema(落盘只含元素ID,不含 vfxItemId——D2);ids 缺省取全部 */
|
|
21
|
+
getSchemas(ids?: string[]): ItemSchema[];
|
|
22
|
+
/** 元素ID 是否已占用(创建前预检) */
|
|
23
|
+
exists(id: string): boolean;
|
|
24
|
+
/** 按元素ID 预检查重(决策 D1):冲突抛 DuplicateElementIdError 带 suggestedId */
|
|
25
|
+
assertUnique(id: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* 创建元素,冲突时透传 DuplicateElementIdError(error.suggestedId 可用于重试)。
|
|
28
|
+
* 返回新建元素的元素ID(D4:对外只见元素ID)。
|
|
29
|
+
*/
|
|
30
|
+
create(schema: ItemSchema): Promise<string>;
|
|
31
|
+
/** 批量按 Schema 改属性,返回成功改动的元素ID 列表 */
|
|
32
|
+
updateMany(schemas: ItemSchema[]): Promise<string[]>;
|
|
33
|
+
/** 单个按 Schema 改属性(updateMany 的单元素便捷入口) */
|
|
34
|
+
updateById(schema: ItemSchema): Promise<string[]>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { VFXItem } from '../../shared';
|
|
2
|
+
import { ElementRegistry } from './element-registry';
|
|
3
|
+
/**
|
|
4
|
+
* 元素身份策略(统一承载「id 基准」与「registry 映射」两个共变决策)
|
|
5
|
+
*
|
|
6
|
+
* - **id 基准**(B):{@link resolveItemId} 决定 artisItem.id 取自 schemaId 还是
|
|
7
|
+
* Player 维度的 vfxItem.instanceId。Artis 取 schemaId(与 vfxItemId 分离,走映射);
|
|
8
|
+
* SceneArtis 取 instanceId(id===vfxItemId,无需映射)。
|
|
9
|
+
* - **registry 映射**(ii):register/unregister/vfxItemIdOf/elementIdOf/assertUnique/clear
|
|
10
|
+
* 委托给具体实现。Artis 走真实 {@link ElementRegistry};SceneArtis 走 identity(空转)。
|
|
11
|
+
*
|
|
12
|
+
* 二者合并为单一策略,避免 ItemService 协调两个独立注入点。
|
|
13
|
+
*/
|
|
14
|
+
export type ElementIdentityStrategy = {
|
|
15
|
+
/**
|
|
16
|
+
* 决定新建元素的 artisItem.id。
|
|
17
|
+
* @param schemaId 来自 ItemSchema.id(或 generateGUID 兜底)
|
|
18
|
+
* @param vfxItem 已创建的 Player 维度 VFXItem(其 instanceId 即 vfxItemId)
|
|
19
|
+
* @returns 实际写入 artisItem.id 的值
|
|
20
|
+
*/
|
|
21
|
+
resolveItemId(schemaId: string, vfxItem: VFXItem): string;
|
|
22
|
+
/** 注册 elementId ↔ vfxItemId 映射(创建时调用) */
|
|
23
|
+
registerMapping(elementId: string, vfxItemId: string): void;
|
|
24
|
+
/** 注销元素映射(删除时调用) */
|
|
25
|
+
unregister(elementId: string): void;
|
|
26
|
+
/** 元素ID → vfxItemId;未注册返回 undefined(调用方兜底原值) */
|
|
27
|
+
vfxItemIdOf(elementId: string): string | undefined;
|
|
28
|
+
/** vfxItemId → 元素ID(反向同步翻译用);未注册返回 undefined */
|
|
29
|
+
elementIdOf(vfxItemId: string): string | undefined;
|
|
30
|
+
/** 元素ID 查重;命中抛 DuplicateElementIdError(携带 suggestedId) */
|
|
31
|
+
assertUnique(elementId: string): void;
|
|
32
|
+
/** 清空所有映射(场景重建/销毁时) */
|
|
33
|
+
clear(): void;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 基于真实 {@link ElementRegistry} 的策略(Artis 用)
|
|
37
|
+
*
|
|
38
|
+
* - `resolveItemId` 直返 schemaId:artisItem.id(schemaId) ≠ vfxItemId(instanceId),
|
|
39
|
+
* 二者分离,靠 registry 翻译。遵守 D2(不 setInstanceId,artis 只读 instanceId)。
|
|
40
|
+
* - 其余委托内部 registry。
|
|
41
|
+
*/
|
|
42
|
+
export declare class RegistryIdentityStrategy implements ElementIdentityStrategy {
|
|
43
|
+
/** 内部 registry(Artis 唯一映射真源) */
|
|
44
|
+
readonly registry: ElementRegistry;
|
|
45
|
+
constructor(registry: ElementRegistry);
|
|
46
|
+
resolveItemId(schemaId: string, _vfxItem: VFXItem): string;
|
|
47
|
+
registerMapping(elementId: string, vfxItemId: string): void;
|
|
48
|
+
unregister(elementId: string): void;
|
|
49
|
+
vfxItemIdOf(elementId: string): string | undefined;
|
|
50
|
+
elementIdOf(vfxItemId: string): string | undefined;
|
|
51
|
+
assertUnique(elementId: string): void;
|
|
52
|
+
clear(): void;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* identity 策略(SceneArtis 用,B:以 VFXItemId 为基准)
|
|
56
|
+
*
|
|
57
|
+
* - `resolveItemId` 返回 `vfxItem.getInstanceId()`:artisItem.id 跟随 Player 分配的 instanceId,
|
|
58
|
+
* 即 id === vfxItemId === instanceId 全程成立,无需映射表。
|
|
59
|
+
* - `vfxItemIdOf`/`elementIdOf` 返回原值(identity):findPlayerItemById 的 `?? id` fallback
|
|
60
|
+
* 直接命中(id 即 instanceId)。
|
|
61
|
+
* - `assertUnique`/`registerMapping`/`unregister`/`clear` 全空转:id 由 Player 分配,
|
|
62
|
+
* 无 artis 侧查重需求;映射自洽无需维护。
|
|
63
|
+
*
|
|
64
|
+
* SceneArtis 加载(assemble 取 getInstanceId 当 id)/恢复(JSONScene 重载 instanceId 复生)
|
|
65
|
+
* 路径本就 id===instanceId;会话内 createItem 经 resolveItemId 亦对齐 instanceId,全程一致。
|
|
66
|
+
*/
|
|
67
|
+
export declare class IdentityStrategy implements ElementIdentityStrategy {
|
|
68
|
+
resolveItemId(_schemaId: string, vfxItem: VFXItem): string;
|
|
69
|
+
registerMapping(_elementId: string, _vfxItemId: string): void;
|
|
70
|
+
unregister(_elementId: string): void;
|
|
71
|
+
vfxItemIdOf(elementId: string): string | undefined;
|
|
72
|
+
elementIdOf(vfxItemId: string): string | undefined;
|
|
73
|
+
assertUnique(_elementId: string): void;
|
|
74
|
+
clear(): void;
|
|
75
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { VFXItem } from '../../shared';
|
|
2
|
+
import type { ElementRegistryDeps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 元素注册表错误码(字符串值 enum,作为对外 error.code 契约)
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ElementRegistryErrorCode {
|
|
7
|
+
DUPLICATE_ELEMENT_ID = "DUPLICATE_ELEMENT_ID"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 元素ID 重复错误(决策 D1)
|
|
11
|
+
*
|
|
12
|
+
* 创建元素时命中已存在的元素ID 即抛此错。错误对象携带:
|
|
13
|
+
* - conflictId:冲突的元素ID(即调用方传入的 id)
|
|
14
|
+
* - suggestedId:一个全新的可用候选 GUID,调用方可拿它重试
|
|
15
|
+
*
|
|
16
|
+
* **不自动改名、不创建**——只"抛错 + 告知候选",由调用方决定是否重试。
|
|
17
|
+
*/
|
|
18
|
+
export declare class DuplicateElementIdError extends Error {
|
|
19
|
+
readonly code = ElementRegistryErrorCode.DUPLICATE_ELEMENT_ID;
|
|
20
|
+
/** 冲突的元素ID(即调用方传入的 id) */
|
|
21
|
+
readonly conflictId: string;
|
|
22
|
+
/** 全新可用的候选元素ID(generateGUID 生成,保证不与已注册元素冲突) */
|
|
23
|
+
readonly suggestedId: string;
|
|
24
|
+
constructor(conflictId: string, suggestedId: string);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 元素注册表(决策 D3:独立模块)
|
|
28
|
+
*
|
|
29
|
+
* 维护「用户可读元素ID ↔ Player 维度 VFXItem id」的双向映射:
|
|
30
|
+
* - 元素ID:用户可见、全局唯一、随 Schema 落盘
|
|
31
|
+
* - vfxItemId:Player GUID,**仅运行时、不落盘**(D2);重建/重载时重新生成
|
|
32
|
+
*
|
|
33
|
+
* 本模块只负责「映射 + 查重 + 翻译」,CRUD 委托 ItemService,不重写。
|
|
34
|
+
*/
|
|
35
|
+
export declare class ElementRegistry {
|
|
36
|
+
/** elementId → vfxItemId */
|
|
37
|
+
private readonly _map;
|
|
38
|
+
/** vfxItemId → elementId(反向查,反向同步翻译用) */
|
|
39
|
+
private readonly _reverse;
|
|
40
|
+
private readonly _deps;
|
|
41
|
+
constructor(deps?: ElementRegistryDeps);
|
|
42
|
+
/**
|
|
43
|
+
* 注册一对 elementId ↔ vfxItemId(创建时调用)
|
|
44
|
+
* 重复注册同一元素ID 会覆盖旧映射(创建链路应先 assertUnique 拦截)
|
|
45
|
+
*/
|
|
46
|
+
register(elementId: string, vfxItemId: string): void;
|
|
47
|
+
/** 注销元素(删除时调用) */
|
|
48
|
+
unregister(elementId: string): void;
|
|
49
|
+
/** 清空所有映射(场景重建/销毁时) */
|
|
50
|
+
clear(): void;
|
|
51
|
+
/**
|
|
52
|
+
* 查重(决策 D1):元素ID 未占用 → 正常返回;命中 → 抛 DuplicateElementIdError
|
|
53
|
+
*
|
|
54
|
+
* 抛出的错误携带 suggestedId(一个不与现有元素ID 冲突的全新 GUID),供调用方重试。
|
|
55
|
+
*/
|
|
56
|
+
assertUnique(elementId: string): void;
|
|
57
|
+
/** 元素ID → vfxItemId */
|
|
58
|
+
vfxItemIdOf(elementId: string): string | undefined;
|
|
59
|
+
/** vfxItemId → 元素ID(反向,反向同步翻译用) */
|
|
60
|
+
elementIdOf(vfxItemId: string): string | undefined;
|
|
61
|
+
/** 元素ID 是否已注册(创建前预检) */
|
|
62
|
+
has(elementId: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* 翻译并解析 VFXItem(元素ID → vfxItemId → VFXItem)
|
|
65
|
+
* 依赖构造时注入的 resolveVfxItemById 回调;未注入或元素未注册时返回 undefined
|
|
66
|
+
*/
|
|
67
|
+
resolveVFXItem(elementId: string): VFXItem | undefined;
|
|
68
|
+
/** 获取只读映射(调试/快照用) */
|
|
69
|
+
getAll(): ReadonlyMap<string, string>;
|
|
70
|
+
/** 已注册元素数量 */
|
|
71
|
+
get size(): number;
|
|
72
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ElementRegistry, DuplicateElementIdError, ElementRegistryErrorCode } from './element-registry';
|
|
2
|
+
export type { ElementRegistryDeps } from './types';
|
|
3
|
+
export { ElementFacade } from './element-facade';
|
|
4
|
+
export { RegistryIdentityStrategy, IdentityStrategy } from './element-identity-strategy';
|
|
5
|
+
export type { ElementIdentityStrategy } from './element-identity-strategy';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { VFXItem } from '../../shared';
|
|
2
|
+
/**
|
|
3
|
+
* 元素注册表运行时依赖(构造注入,走回调避开与 ItemService 的循环依赖)
|
|
4
|
+
*/
|
|
5
|
+
export type ElementRegistryDeps = {
|
|
6
|
+
/**
|
|
7
|
+
* 按 vfxItemId 查 VFXItem。由 ItemService 注入(回调解耦,不持有 player 引用)。
|
|
8
|
+
* 可选——缺省时 resolveVFXItem 永远返回 undefined。
|
|
9
|
+
*/
|
|
10
|
+
resolveVfxItemById?: (vfxItemId: string) => VFXItem | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* 查重冲突时生成候选元素ID。默认 generateGUID;可注入 mock 便于单测。
|
|
13
|
+
*/
|
|
14
|
+
generateId?: () => string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { GestureHandler } from '@vvfx/gizmo';
|
|
2
|
+
import type { CommandBindingContext, GizmoBridgeEvent, GizmoBridgeEventArgs } from './gizmo-command-binder';
|
|
3
|
+
import { ItemService } from '../service';
|
|
4
|
+
import type { ViewService, InteractionService } from '../service';
|
|
5
|
+
import type { Store } from '../store';
|
|
6
|
+
import type { CommandService } from '../command';
|
|
7
|
+
/**
|
|
8
|
+
* GizmoBootstrap 装配所需的最小上下文。
|
|
9
|
+
*
|
|
10
|
+
* 核心服务由 BaseArtis 直接注入(commandService / store / itemService / viewService /
|
|
11
|
+
* interactionService),元素创建由 Command 绑定直接完成;
|
|
12
|
+
* emitGizmoEvent 委托到 BaseArtis._handleGizmoEvent,统一转发到 Artis 事件系统。
|
|
13
|
+
*/
|
|
14
|
+
export type GizmoBootstrapContext = {
|
|
15
|
+
readonly commandService: CommandService;
|
|
16
|
+
readonly store: Store;
|
|
17
|
+
readonly itemService: ItemService;
|
|
18
|
+
readonly viewService: ViewService;
|
|
19
|
+
readonly interactionService: InteractionService;
|
|
20
|
+
readonly gestureHandler: GestureHandler;
|
|
21
|
+
readonly enterMoveState: () => void;
|
|
22
|
+
readonly notifyItemCreated: CommandBindingContext['notifyItemCreated'];
|
|
23
|
+
emitGizmoEvent<K extends GizmoBridgeEvent>(event: K, ...args: GizmoBridgeEventArgs<K>): void;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* GizmoBootstrap - Gizmo 子系统装配协作者。
|
|
27
|
+
*
|
|
28
|
+
* 从 BaseArtis 抽离,统一承载 GizmoCommandBinder、GestureHandler 事件转发
|
|
29
|
+
* 与 Resize Gizmo 视口配置同步。
|
|
30
|
+
*
|
|
31
|
+
* 装配幂等:assemble() 第二次调用起跳过装配分支(与原 initGizmo 守卫语义一致)。
|
|
32
|
+
*/
|
|
33
|
+
export declare class GizmoBootstrap {
|
|
34
|
+
private readonly ctx;
|
|
35
|
+
private _assembled;
|
|
36
|
+
private _binder?;
|
|
37
|
+
/** Hand 平移行为 action 订阅解绑函数 */
|
|
38
|
+
private _viewportNavigationOff?;
|
|
39
|
+
/** Resize Gizmo 视口配置同步解绑函数。 */
|
|
40
|
+
private _viewServiceOff?;
|
|
41
|
+
/** Command 之外的 GestureHandler 事件转发解绑函数。 */
|
|
42
|
+
private _eventOffs;
|
|
43
|
+
constructor(ctx: GizmoBootstrapContext);
|
|
44
|
+
/**
|
|
45
|
+
* 装配 Gizmo 子系统并触发 Gizmo 实例创建。
|
|
46
|
+
*
|
|
47
|
+
* 幂等:二次调用直接返回(仅靠调用方先刷新 InteractionService 数据)。
|
|
48
|
+
*/
|
|
49
|
+
assemble(): void;
|
|
50
|
+
/**
|
|
51
|
+
* 视口导航 action 同步:把 GestureHandler 派发的 scale/center/translation 写入
|
|
52
|
+
* ViewService 与 InteractionService。从原数据适配器 setViewParam 内联移入——
|
|
53
|
+
* gizmo 包不依赖 InteractionService/ViewService,故由本装配层落地。
|
|
54
|
+
*/
|
|
55
|
+
private setViewParam;
|
|
56
|
+
/**
|
|
57
|
+
* 构建 Command 绑定上下文(供 GizmoCommandBinder 调用绑定工厂时使用)。
|
|
58
|
+
*
|
|
59
|
+
* 核心服务由装配上下文直接透传,emit 委托 emitGizmoEvent →
|
|
60
|
+
* BaseArtis._handleGizmoEvent 转发到 Artis 事件系统。
|
|
61
|
+
*
|
|
62
|
+
* @returns 当前装配上下文构造出的 Command 绑定上下文对象
|
|
63
|
+
*/
|
|
64
|
+
private createCommandBindingContext;
|
|
65
|
+
/**
|
|
66
|
+
* 销毁 Gizmo 子系统的统一 Action 订阅与事件转发订阅。
|
|
67
|
+
* 未装配时为空操作。
|
|
68
|
+
*/
|
|
69
|
+
dispose(): void;
|
|
70
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Box2, GestureHandler, GizmoActionEvent, GizmoFrameRefreshChildrenEvent, GizmoPlacementChangeEvent, Selection } from '@vvfx/gizmo';
|
|
2
|
+
import type { CommandService } from '../command';
|
|
3
|
+
import type { ItemService } from '../service';
|
|
4
|
+
import type { Store } from '../store';
|
|
5
|
+
import type { BaseArtisEvents } from '../types/artis-events';
|
|
6
|
+
type GizmoBridgeEvents = BaseArtisEvents & {
|
|
7
|
+
'picture-cut.change': [info: {
|
|
8
|
+
box: Box2;
|
|
9
|
+
}];
|
|
10
|
+
'picture-expand.change': [info: {
|
|
11
|
+
box: Box2;
|
|
12
|
+
}];
|
|
13
|
+
};
|
|
14
|
+
/** Services available to command-side Gizmo action handlers. */
|
|
15
|
+
export type CommandBindingContext = {
|
|
16
|
+
selection: Selection;
|
|
17
|
+
commandService: CommandService;
|
|
18
|
+
itemService: ItemService;
|
|
19
|
+
store: Store;
|
|
20
|
+
emit: <K extends GizmoBridgeEvent>(event: K, ...args: GizmoBridgeEventArgs<K>) => void;
|
|
21
|
+
/** 元素已由绑定层创建后,仅向 SDK 使用方派发完成事件。 */
|
|
22
|
+
notifyItemCreated: (info: BaseArtisEvents['item.create'][0]) => void;
|
|
23
|
+
/** Text / Frame 创建完成后切回默认选择工具。 */
|
|
24
|
+
enterMoveState: () => void;
|
|
25
|
+
/** Text 实时创建首帧后进入当前单选文字的编辑态。 */
|
|
26
|
+
beginCreatedTextEditing: () => void;
|
|
27
|
+
/** 实时创建 Text 被取消时退出对应编辑态。 */
|
|
28
|
+
finishCreatedTextEditing: () => void;
|
|
29
|
+
};
|
|
30
|
+
export type GizmoBridgeEvent = 'item.create' | 'item.dragstart' | 'item.drag' | 'item.dragend' | 'item.propertychange' | 'loading.change' | 'spritetext.click' | 'text.input' | 'video.play' | 'picture-cut.change' | 'picture-expand.change';
|
|
31
|
+
export type GizmoBridgeEventArgs<K extends GizmoBridgeEvent> = GizmoBridgeEvents[K];
|
|
32
|
+
/** Command behavior for one Gizmo type on the unified GestureHandler action stream. */
|
|
33
|
+
export type CommandActionBinding = {
|
|
34
|
+
actionstart?: (event: GizmoActionEvent) => void;
|
|
35
|
+
actionupdate?: (event: GizmoActionEvent) => void;
|
|
36
|
+
actioncommit?: (event: GizmoActionEvent) => void;
|
|
37
|
+
placementchange?: (event: GizmoPlacementChangeEvent) => void;
|
|
38
|
+
framerefreshchildren?: (event: GizmoFrameRefreshChildrenEvent) => void;
|
|
39
|
+
dispose?: () => void;
|
|
40
|
+
};
|
|
41
|
+
/** Creates one long-lived command handler for a Gizmo type. */
|
|
42
|
+
export type CommandBindingFactory = (context: CommandBindingContext) => CommandActionBinding;
|
|
43
|
+
/**
|
|
44
|
+
* Routes the single GestureHandler action stream to command handlers by semantic Gizmo type.
|
|
45
|
+
* It never subscribes to concrete Gizmo instances and is therefore independent of graph rebuilds.
|
|
46
|
+
*/
|
|
47
|
+
export declare class GizmoCommandBinder {
|
|
48
|
+
private readonly _contextProvider;
|
|
49
|
+
private readonly _bindings;
|
|
50
|
+
private readonly _offs;
|
|
51
|
+
constructor(gestureHandler: GestureHandler, _contextProvider: () => CommandBindingContext);
|
|
52
|
+
register(type: string, factory: CommandBindingFactory): void;
|
|
53
|
+
dispose(): void;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AnyConfigDefinition, ConfigValue, GizmoManager } from '@vvfx/gizmo';
|
|
2
|
+
/**
|
|
3
|
+
* 一条 Gizmo 配置初始化覆盖:[配置定义, 要合并的部分值]。
|
|
4
|
+
*
|
|
5
|
+
* 供 {@link "artis/types".ArtisOptions.gizmoConfigs} 在构造期一次性注入产品级 Gizmo 默认配置
|
|
6
|
+
* (线宽/颜色/笔刷/遮罩开关等)。config 定义本身(token 与默认值)仍由 `@vvfx/gizmo` 提供
|
|
7
|
+
* (见 `builtin-configs`,如 `maskConfig`、`viewportOverlayConfig`);本模块只负责把
|
|
8
|
+
* 「token + partial」打包成元组,属 Artis 初始化入参形状,非 Gizmo 核心能力,故归置于 Artis 侧。
|
|
9
|
+
*/
|
|
10
|
+
export type GizmoConfigOverride<D extends AnyConfigDefinition = AnyConfigDefinition> = readonly [definition: D, partial: Partial<ConfigValue<D>>];
|
|
11
|
+
/**
|
|
12
|
+
* 构造一条 Gizmo 配置初始化覆盖,供 `ArtisOptions.gizmoConfigs` 在构造期一次性注入。
|
|
13
|
+
* 调用点对 partial 的键/值类型依 definition 推断并校验,例如:
|
|
14
|
+
* ```ts
|
|
15
|
+
* gizmoConfig(maskConfig, { brushSize: 30 })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function gizmoConfig<D extends AnyConfigDefinition>(definition: D, partial: Partial<ConfigValue<D>>): GizmoConfigOverride<D>;
|
|
19
|
+
/**
|
|
20
|
+
* 把宿主声明的 Gizmo 配置初始化覆盖逐条合并进 ConfigManager。
|
|
21
|
+
* 复用 `ConfigManager.set` 的默认合并 / 校验 / 事件语义;无 overrides 时为 no-op。
|
|
22
|
+
* 引擎无关纯函数,供构造器与单测共用(避免把「可测性」泄漏成 BaseArtis 的公开方法)。
|
|
23
|
+
*/
|
|
24
|
+
export declare function applyGizmoConfigs(gizmoManager: GizmoManager, overrides?: readonly GizmoConfigOverride[]): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Gizmo, GizmoOwner } from '@vvfx/gizmo';
|
|
2
|
+
import type { BaseState } from '../state';
|
|
3
|
+
import type { StateId } from '../state';
|
|
4
|
+
export type GizmoRegistrationId = string & {};
|
|
5
|
+
export declare enum BuiltinGizmoId {
|
|
6
|
+
HAND = "hand",
|
|
7
|
+
ICON = "icon",
|
|
8
|
+
LOADING = "loading",
|
|
9
|
+
VIEWPORT_OVERLAY = "viewport-overlay",
|
|
10
|
+
READONLY_SELECTION = "readonly-selection",
|
|
11
|
+
PICTURE_CUT = "picture-cut",
|
|
12
|
+
PICTURE_EXPAND = "picture-expand",
|
|
13
|
+
SPRITE_TEXT_EDIT = "sprite-text-edit",
|
|
14
|
+
MASK = "mask",
|
|
15
|
+
ITEM_CREATE = "item-create"
|
|
16
|
+
}
|
|
17
|
+
export type GizmoFactoryContext = {
|
|
18
|
+
readonly owner: GizmoOwner;
|
|
19
|
+
readonly state: BaseState;
|
|
20
|
+
readonly registry: GizmoRegistry;
|
|
21
|
+
};
|
|
22
|
+
export type RegisteredGizmoFactory = (context: GizmoFactoryContext) => Gizmo | readonly Gizmo[];
|
|
23
|
+
export type StateGizmoBinding = GizmoRegistrationId | RegisteredGizmoFactory;
|
|
24
|
+
export type GizmoRegistryOptions = {
|
|
25
|
+
readonly onReplace?: (id: GizmoRegistrationId) => void;
|
|
26
|
+
};
|
|
27
|
+
/** Artis-owned registry used by extension states to compose ordered Gizmo sets. */
|
|
28
|
+
export declare class GizmoRegistry {
|
|
29
|
+
private readonly _options;
|
|
30
|
+
private readonly _factories;
|
|
31
|
+
private readonly _consumers;
|
|
32
|
+
constructor(_options?: GizmoRegistryOptions);
|
|
33
|
+
register(id: GizmoRegistrationId, factory: RegisteredGizmoFactory): void;
|
|
34
|
+
replace(id: GizmoRegistrationId, factory: RegisteredGizmoFactory): void;
|
|
35
|
+
unregister(id: GizmoRegistrationId): void;
|
|
36
|
+
has(id: GizmoRegistrationId): boolean;
|
|
37
|
+
getConsumers(id: GizmoRegistrationId): readonly StateId[];
|
|
38
|
+
createSet(bindings: readonly StateGizmoBinding[], owner: GizmoOwner, state: BaseState): Gizmo[];
|
|
39
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gizmo 子系统(core/gizmo)
|
|
3
|
+
*
|
|
4
|
+
* Frame data is owned by FrameManager; this layer only bridges commands, selection, and Artis services.
|
|
5
|
+
* Command 绑定(GizmoCommandBinder)与宿主 State 交互图装配(GizmoBootstrap)。
|
|
6
|
+
*
|
|
7
|
+
* 设计:本模块属于编辑器核心,不依赖 GestureHandler(手势事件层),后者注入消费本模块。
|
|
8
|
+
* gizmo 与宿主(GestureHandler)经 GizmoOwner 接口契约通信——GestureHandler 实现 GizmoOwner,
|
|
9
|
+
* State 创建 gizmo 时把 owner 与 Gizmo 依赖显式传入构造;共享态由 GestureHandler 与 FrameManager 持有,
|
|
10
|
+
* 输入态由 GestureHandler 持有,gizmo 经 owner 统一读取,不再有"数据袋子" ctx。
|
|
11
|
+
*/
|
|
12
|
+
export { GizmoCommandBinder } from './gizmo-command-binder';
|
|
13
|
+
export type { CommandBindingContext, CommandBindingFactory, CommandActionBinding, GizmoBridgeEvent, GizmoBridgeEventArgs, } from './gizmo-command-binder';
|
|
14
|
+
export { GizmoBootstrap } from './gizmo-bootstrap';
|
|
15
|
+
export type { GizmoBootstrapContext } from './gizmo-bootstrap';
|
|
16
|
+
export { BuiltinGizmoId, GizmoRegistry } from './gizmo-registry';
|
|
17
|
+
export type { GizmoFactoryContext, GizmoRegistrationId, RegisteredGizmoFactory, StateGizmoBinding, } from './gizmo-registry';
|
|
18
|
+
export { gizmoConfig, applyGizmoConfigs } from './gizmo-config-override';
|
|
19
|
+
export type { GizmoConfigOverride } from './gizmo-config-override';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gizmo Command 绑定注册
|
|
3
|
+
*
|
|
4
|
+
* 本文件将各 Gizmo 的 Command 绑定逻辑从 Gizmo 类中抽离,
|
|
5
|
+
* 集中到 Artis 层注册,使得 Gizmo 包不依赖任何 Artis 内部类型。
|
|
6
|
+
*
|
|
7
|
+
* 各 Gizmo 只负责发事件,Artis 层通过 GizmoCommandBinder.register 注册绑定工厂。
|
|
8
|
+
*/
|
|
9
|
+
import { type CommandBindingFactory, type GizmoCommandBinder } from './index';
|
|
10
|
+
export declare const registerResizeSelectionCommandBinding: CommandBindingFactory;
|
|
11
|
+
export declare const registerCornerRotationCommandBinding: CommandBindingFactory;
|
|
12
|
+
export declare const registerMoveSelectionCommandBinding: CommandBindingFactory;
|
|
13
|
+
/**
|
|
14
|
+
* 固定宽度 Text 的首个有效拖拽立即 beginInteraction 创建真实元素并进入编辑态,
|
|
15
|
+
* 后续帧更新同一命令,mouseup 只把最终 schema 入 History。Frame 与纯点击在 commit 创建一次。
|
|
16
|
+
*/
|
|
17
|
+
export declare const createItemCreateCommandBinding: CommandBindingFactory;
|
|
18
|
+
/** Bind point and box selection commits to Artis history. */
|
|
19
|
+
export declare const registerSelectionGizmoCommandBinding: CommandBindingFactory;
|
|
20
|
+
export declare function registerBuiltinCommandBindings(binder: GizmoCommandBinder): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GestureHandler } from '@vvfx/gizmo';
|
|
2
|
+
import { ItemCreateType } from '@vvfx/gizmo';
|
|
3
|
+
import type { BaseState } from '../state';
|
|
4
|
+
import type { StateTransitionRuntime } from '../state/types';
|
|
5
|
+
import { GizmoRegistry } from './gizmo-registry';
|
|
6
|
+
/** Converts the active Artis State into an ordered GizmoTool runtime projection. */
|
|
7
|
+
export declare class StateGizmoController implements StateTransitionRuntime {
|
|
8
|
+
private readonly _gestureHandler;
|
|
9
|
+
readonly registry: GizmoRegistry;
|
|
10
|
+
private _itemCreateType;
|
|
11
|
+
constructor(_gestureHandler: GestureHandler, registry: GizmoRegistry);
|
|
12
|
+
get itemCreateType(): ItemCreateType;
|
|
13
|
+
set itemCreateType(value: ItemCreateType);
|
|
14
|
+
apply(state: BaseState): void;
|
|
15
|
+
reapply(state: BaseState): void;
|
|
16
|
+
registerState(state: BaseState): void;
|
|
17
|
+
unregisterState(state: BaseState): void;
|
|
18
|
+
private _createGizmoTool;
|
|
19
|
+
private _registerBuiltins;
|
|
20
|
+
}
|