@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,205 @@
|
|
|
1
|
+
import type { spec } from '../../shared';
|
|
2
|
+
import type { ArtisItemType, CardItem } from '../item';
|
|
3
|
+
import type { FrameLayoutMode, AutoLayoutConfig, LayoutInfo } from './frame';
|
|
4
|
+
import type { CardHTML } from './item-property';
|
|
5
|
+
export type SpriteCreateInfo = {
|
|
6
|
+
type: ArtisItemType.SPRITE;
|
|
7
|
+
name?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
parentId?: string;
|
|
10
|
+
extension?: Record<string, any>;
|
|
11
|
+
property: {
|
|
12
|
+
image?: string;
|
|
13
|
+
/** 像素宽度,缺省 = auto 自适应(资源就绪后按原生尺寸收敛,占位 300×300) */
|
|
14
|
+
width?: number;
|
|
15
|
+
/** 像素高度,缺省 = auto 自适应 */
|
|
16
|
+
height?: number;
|
|
17
|
+
/** 像素位置,缺省 [0,0] */
|
|
18
|
+
position?: [number, number];
|
|
19
|
+
rotation?: number | [number, number, number];
|
|
20
|
+
scale?: [number, number];
|
|
21
|
+
/** 尺寸模式,缺省按 width/height 是否指定推导(任一缺省 → auto) */
|
|
22
|
+
sizeMode?: 'auto' | 'fixed';
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type GroupCreateInfo = {
|
|
26
|
+
type: ArtisItemType.GROUP;
|
|
27
|
+
id?: string;
|
|
28
|
+
parentId?: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
extension?: Record<string, any>;
|
|
31
|
+
property: {
|
|
32
|
+
position?: [number, number];
|
|
33
|
+
rotation?: number | [number, number, number];
|
|
34
|
+
scale?: [number, number];
|
|
35
|
+
children: string[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export type TextCreateInfo = {
|
|
39
|
+
type: ArtisItemType.TEXT;
|
|
40
|
+
id?: string;
|
|
41
|
+
parentId?: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
extension?: Record<string, any>;
|
|
44
|
+
property: {
|
|
45
|
+
width: number;
|
|
46
|
+
height?: number;
|
|
47
|
+
position: [number, number];
|
|
48
|
+
rotation?: number | [number, number, number];
|
|
49
|
+
scale?: [number, number];
|
|
50
|
+
lineHeight: number;
|
|
51
|
+
fontFamily: string;
|
|
52
|
+
fontSize: number;
|
|
53
|
+
fontWeight?: spec.TextWeight;
|
|
54
|
+
fontStyle?: spec.FontStyle;
|
|
55
|
+
textAlign?: spec.TextAlignment;
|
|
56
|
+
text: string;
|
|
57
|
+
color: spec.vec4;
|
|
58
|
+
outlineColor?: spec.vec4;
|
|
59
|
+
outlineWidth?: number;
|
|
60
|
+
outlineEnabled?: boolean;
|
|
61
|
+
fontUrl?: string;
|
|
62
|
+
letterSpacing?: number;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export type VideoCreateInfo = {
|
|
66
|
+
type: ArtisItemType.VIDEO;
|
|
67
|
+
name?: string;
|
|
68
|
+
id?: string;
|
|
69
|
+
parentId?: string;
|
|
70
|
+
extension?: Record<string, any>;
|
|
71
|
+
property: {
|
|
72
|
+
video?: string;
|
|
73
|
+
/** 像素宽度,缺省 = auto 自适应(资源就绪后按原生尺寸收敛,占位 400×300) */
|
|
74
|
+
width?: number;
|
|
75
|
+
/** 像素高度,缺省 = auto 自适应 */
|
|
76
|
+
height?: number;
|
|
77
|
+
/** 像素位置,缺省 [0,0] */
|
|
78
|
+
position?: [number, number];
|
|
79
|
+
rotation?: number | [number, number, number];
|
|
80
|
+
scale?: [number, number];
|
|
81
|
+
muted?: boolean;
|
|
82
|
+
transparent?: boolean;
|
|
83
|
+
playbackRate?: number;
|
|
84
|
+
volume?: number;
|
|
85
|
+
/** 尺寸模式,缺省按 width/height 是否指定推导(任一缺省 → auto) */
|
|
86
|
+
sizeMode?: 'auto' | 'fixed';
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export type CardType = string;
|
|
90
|
+
export type CardCreateInfo = {
|
|
91
|
+
type: ArtisItemType.CARD;
|
|
92
|
+
name?: string;
|
|
93
|
+
id?: string;
|
|
94
|
+
parentId?: string;
|
|
95
|
+
extension?: Record<string, any>;
|
|
96
|
+
property: {
|
|
97
|
+
cardType: CardType;
|
|
98
|
+
width: number;
|
|
99
|
+
height: number;
|
|
100
|
+
autoHeight?: boolean;
|
|
101
|
+
position: [number, number];
|
|
102
|
+
rotation?: number | [number, number, number];
|
|
103
|
+
scale?: [number, number];
|
|
104
|
+
html?: CardHTML;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export declare enum GeneratorType {
|
|
108
|
+
IMAGE = "image",
|
|
109
|
+
VIDEO = "video"
|
|
110
|
+
}
|
|
111
|
+
export type GeneratorCreateInfo = {
|
|
112
|
+
type: ArtisItemType.GENERATOR;
|
|
113
|
+
name?: string;
|
|
114
|
+
id?: string;
|
|
115
|
+
parentId?: string;
|
|
116
|
+
extension?: Record<string, any>;
|
|
117
|
+
property: {
|
|
118
|
+
generatorType: GeneratorType;
|
|
119
|
+
width: number;
|
|
120
|
+
height: number;
|
|
121
|
+
position: [number, number];
|
|
122
|
+
rotation?: number | [number, number, number];
|
|
123
|
+
scale?: [number, number];
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
export type EffectsCreateInfo = {
|
|
127
|
+
type: ArtisItemType.EFFECTS;
|
|
128
|
+
name?: string;
|
|
129
|
+
id?: string;
|
|
130
|
+
parentId?: string;
|
|
131
|
+
property: {
|
|
132
|
+
width?: number;
|
|
133
|
+
height?: number;
|
|
134
|
+
position: spec.vec2;
|
|
135
|
+
rotation?: number | [number, number, number];
|
|
136
|
+
scale?: spec.vec2;
|
|
137
|
+
effects?: string;
|
|
138
|
+
/**
|
|
139
|
+
* 是否自适应大小(只读,初值在 create 期锁定后不再改)。
|
|
140
|
+
* - 未显式传时:width/height 任一缺省即为 true(元素大小随资源主合成自适应)。
|
|
141
|
+
* - 显式传 true/false 时:以传入值为准。
|
|
142
|
+
* false:加载/切换资源时元素大小不变(create 期定死)。
|
|
143
|
+
* true:加载/切换资源时元素大小随新资源主合成 previewSize 变化。
|
|
144
|
+
*/
|
|
145
|
+
autoFit?: boolean;
|
|
146
|
+
};
|
|
147
|
+
extension?: Record<string, any>;
|
|
148
|
+
};
|
|
149
|
+
export type FrameCreateInfo = {
|
|
150
|
+
type: ArtisItemType.FRAME;
|
|
151
|
+
name?: string;
|
|
152
|
+
id?: string;
|
|
153
|
+
parentId?: string;
|
|
154
|
+
property: {
|
|
155
|
+
width: number;
|
|
156
|
+
height: number;
|
|
157
|
+
position: [number, number];
|
|
158
|
+
rotation?: number | [number, number, number];
|
|
159
|
+
scale?: [number, number];
|
|
160
|
+
layoutMode?: FrameLayoutMode;
|
|
161
|
+
children: string[];
|
|
162
|
+
autoLayoutConfig?: AutoLayoutConfig;
|
|
163
|
+
layoutInfos?: Record<string, LayoutInfo>;
|
|
164
|
+
};
|
|
165
|
+
extension?: Record<string, any>;
|
|
166
|
+
};
|
|
167
|
+
export type AsyncSpriteCreateInfo = SpriteCreateInfo & {
|
|
168
|
+
textureId: string;
|
|
169
|
+
};
|
|
170
|
+
export type AsyncVideoCreateInfo = VideoCreateInfo & {
|
|
171
|
+
textureId: string;
|
|
172
|
+
};
|
|
173
|
+
export type ItemCreateInfo = GroupCreateInfo | SpriteCreateInfo | TextCreateInfo | VideoCreateInfo | GeneratorCreateInfo | EffectsCreateInfo | FrameCreateInfo | CardCreateInfo;
|
|
174
|
+
export type AsyncItemCreateInfo = GroupCreateInfo | TextCreateInfo | AsyncSpriteCreateInfo | AsyncVideoCreateInfo;
|
|
175
|
+
/**
|
|
176
|
+
* 场景创建信息(createSceneByCreateInfos 的 sceneInfo 入参)。
|
|
177
|
+
* 注:原名 SceneCreaetInfo(拼写错误),已纠正为 SceneCreateInfo。
|
|
178
|
+
*/
|
|
179
|
+
export type SceneCreateInfo = {
|
|
180
|
+
name: string;
|
|
181
|
+
size: spec.vec2;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* 卡片类型配置条目(原 core/config.ts,随 SDKConfig 僵尸结构清理迁入)。
|
|
185
|
+
*/
|
|
186
|
+
export type CardTypeConfig = {
|
|
187
|
+
/** 卡片类型标识 */
|
|
188
|
+
type: string;
|
|
189
|
+
/** 卡片类型显示名称 */
|
|
190
|
+
label: string;
|
|
191
|
+
/** ResizeSelectionGizmo 左上角展示的 icon URL */
|
|
192
|
+
iconUrl: string;
|
|
193
|
+
/** 由 cardType 动态解析的 HTML 渲染配置,不进入序列化数据。 */
|
|
194
|
+
html?: (item: CardItem) => CardHTML | undefined;
|
|
195
|
+
/** 是否按 HTML 内容自然高度更新卡片高度。 */
|
|
196
|
+
autoHeight?: boolean;
|
|
197
|
+
/** 自动高度锚点,默认保持顶部不动。 */
|
|
198
|
+
autoHeightAnchor?: 'top' | 'center';
|
|
199
|
+
/** HTML 内容是否跟随卡片 scale 缩放,默认 true。 */
|
|
200
|
+
autoScale?: boolean;
|
|
201
|
+
/** 是否启用双击编辑态,默认 true。 */
|
|
202
|
+
editable?: boolean;
|
|
203
|
+
/** 非编辑态可直接响应事件的额外选择器。 */
|
|
204
|
+
htmlInteractionSelectors?: string[];
|
|
205
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { GeneratorType } from './item-create-info';
|
|
2
|
+
import { FrameLayoutMode, type AutoLayoutConfig, type LayoutInfo } from './frame';
|
|
3
|
+
import { type spec } from '../../shared';
|
|
4
|
+
export type BaseItemProperty = {
|
|
5
|
+
position: [number, number];
|
|
6
|
+
rotation: [number, number, number];
|
|
7
|
+
scale: [number, number];
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
export type SpriteItemProperty = BaseItemProperty & {
|
|
12
|
+
image: string;
|
|
13
|
+
/**
|
|
14
|
+
* 尺寸模式:'auto'=随资源原生尺寸自适应(未拿资源前占位 300×300);'fixed'=尺寸定死,换源不改。
|
|
15
|
+
* 缺省等价 'fixed'(兼容旧档——旧档尺寸显式给定)。auto→fixed 在用户显式设尺寸(item.transform 带
|
|
16
|
+
* width/height)时翻转;gizmo 拖拽改 scale 不翻状态。状态字段本身不单独进 undo(尺寸变更已进 undo)。
|
|
17
|
+
*/
|
|
18
|
+
sizeMode?: 'auto' | 'fixed';
|
|
19
|
+
};
|
|
20
|
+
export type GroupItemProperty = BaseItemProperty & {
|
|
21
|
+
children: string[];
|
|
22
|
+
};
|
|
23
|
+
export type TextItemProperty = BaseItemProperty & {
|
|
24
|
+
fontFamily: string;
|
|
25
|
+
color: [number, number, number, number];
|
|
26
|
+
fontWeight: spec.TextWeight;
|
|
27
|
+
text: string;
|
|
28
|
+
textAlign: spec.TextAlignment;
|
|
29
|
+
fontSize: number;
|
|
30
|
+
fontStyle: spec.FontStyle;
|
|
31
|
+
lineHeight: number;
|
|
32
|
+
outlineColor?: spec.vec4;
|
|
33
|
+
outlineWidth?: number;
|
|
34
|
+
outlineEnabled?: boolean;
|
|
35
|
+
letterSpacing?: number;
|
|
36
|
+
fontUrl?: string;
|
|
37
|
+
};
|
|
38
|
+
export type VideoItemProperty = BaseItemProperty & {
|
|
39
|
+
video: string;
|
|
40
|
+
muted?: boolean;
|
|
41
|
+
transparent?: boolean;
|
|
42
|
+
playbackRate?: number;
|
|
43
|
+
volume?: number;
|
|
44
|
+
/**
|
|
45
|
+
* 尺寸模式:'auto'=随资源原生尺寸自适应(未拿资源前占位 400×300);'fixed'=尺寸定死,换源不改。
|
|
46
|
+
* 缺省等价 'fixed'(兼容旧档)。auto→fixed 在用户显式设尺寸时翻转;gizmo 改 scale 不翻状态。
|
|
47
|
+
*/
|
|
48
|
+
sizeMode?: 'auto' | 'fixed';
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Generator 表单属性
|
|
52
|
+
*/
|
|
53
|
+
export type GeneratorItemProperty = BaseItemProperty & {
|
|
54
|
+
generatorType: GeneratorType;
|
|
55
|
+
};
|
|
56
|
+
export type EffectsItemProperty = BaseItemProperty & {
|
|
57
|
+
effects: string;
|
|
58
|
+
children?: string[];
|
|
59
|
+
/**
|
|
60
|
+
* 是否自适应大小(只读,初值在 create 期锁定后不再改、不暴露 UI、不进 undo)。
|
|
61
|
+
* true:加载/切换资源时元素大小随新资源主合成 previewSize 变化;
|
|
62
|
+
* false:加载/切换资源时元素大小不变(create 期定死)。
|
|
63
|
+
*/
|
|
64
|
+
autoFit?: boolean;
|
|
65
|
+
};
|
|
66
|
+
export type CardHTMLRenderCleanup = () => void;
|
|
67
|
+
export type CardHTMLContentCleanup = (container: HTMLElement) => void;
|
|
68
|
+
export type CardHTMLDOMRenderer = (container: HTMLElement) => void;
|
|
69
|
+
export type CardHTMLPatchContext = {
|
|
70
|
+
id: string;
|
|
71
|
+
html: CardHTML;
|
|
72
|
+
content: CardHTMLContent;
|
|
73
|
+
container?: HTMLElement;
|
|
74
|
+
contentWindow?: Window | null;
|
|
75
|
+
refresh: () => void;
|
|
76
|
+
};
|
|
77
|
+
export type CardHTMLPatchHandler = (patch: unknown, context: CardHTMLPatchContext) => boolean | undefined;
|
|
78
|
+
export type CardHTMLWindowEventMessage = {
|
|
79
|
+
source: 'vvfx-card-html-event';
|
|
80
|
+
type: string;
|
|
81
|
+
detail?: unknown;
|
|
82
|
+
payload?: unknown;
|
|
83
|
+
};
|
|
84
|
+
export type CardHTMLInlineContent = {
|
|
85
|
+
kind: 'inline';
|
|
86
|
+
html: string;
|
|
87
|
+
sandbox?: boolean | string;
|
|
88
|
+
allowAnchorNavigation?: boolean;
|
|
89
|
+
patch?: CardHTMLPatchHandler;
|
|
90
|
+
cleanup?: CardHTMLContentCleanup;
|
|
91
|
+
};
|
|
92
|
+
export type CardHTMLDOMRendererContent = {
|
|
93
|
+
kind: 'dom';
|
|
94
|
+
target?: 'host' | 'iframe';
|
|
95
|
+
render: CardHTMLDOMRenderer;
|
|
96
|
+
patch?: CardHTMLPatchHandler;
|
|
97
|
+
cleanup?: CardHTMLContentCleanup;
|
|
98
|
+
};
|
|
99
|
+
export type CardHTMLDocumentMessage = {
|
|
100
|
+
source: 'vvfx-card-html';
|
|
101
|
+
type: string;
|
|
102
|
+
payload?: unknown;
|
|
103
|
+
};
|
|
104
|
+
export type CardHTMLDocumentContent = {
|
|
105
|
+
kind: 'document';
|
|
106
|
+
entry: string;
|
|
107
|
+
files: Record<string, string>;
|
|
108
|
+
baseUrl?: string;
|
|
109
|
+
sandbox?: boolean | string;
|
|
110
|
+
allowAnchorNavigation?: boolean;
|
|
111
|
+
allowHostMessaging?: boolean;
|
|
112
|
+
onMessage?: (message: CardHTMLDocumentMessage) => void;
|
|
113
|
+
patch?: CardHTMLPatchHandler;
|
|
114
|
+
cleanup?: CardHTMLContentCleanup;
|
|
115
|
+
};
|
|
116
|
+
export type CardHTMLContent = CardHTMLInlineContent | CardHTMLDOMRendererContent | CardHTMLDocumentContent;
|
|
117
|
+
export type CardHTMLShellRendererResult = HTMLElement | {
|
|
118
|
+
contentContainer: HTMLElement;
|
|
119
|
+
cleanup?: CardHTMLRenderCleanup;
|
|
120
|
+
};
|
|
121
|
+
export type CardHTMLShellRendererContext = {
|
|
122
|
+
content: CardHTMLContent;
|
|
123
|
+
};
|
|
124
|
+
export type CardHTMLShellRenderer = (container: HTMLElement, context: CardHTMLShellRendererContext) => CardHTMLShellRendererResult;
|
|
125
|
+
export type CardHTMLShellContent = {
|
|
126
|
+
kind: 'dom';
|
|
127
|
+
render: CardHTMLShellRenderer;
|
|
128
|
+
};
|
|
129
|
+
export type CardHTMLRootStyle = Record<string, string | number | undefined>;
|
|
130
|
+
export type CardHTMLRootConfig = {
|
|
131
|
+
className?: string;
|
|
132
|
+
style?: CardHTMLRootStyle;
|
|
133
|
+
};
|
|
134
|
+
export type CardHTML = {
|
|
135
|
+
content: CardHTMLContent;
|
|
136
|
+
shell?: CardHTMLShellContent;
|
|
137
|
+
root?: CardHTMLRootConfig;
|
|
138
|
+
};
|
|
139
|
+
export type CardItemProperty = BaseItemProperty & {
|
|
140
|
+
cardType: string;
|
|
141
|
+
autoHeight?: boolean;
|
|
142
|
+
html?: CardHTML;
|
|
143
|
+
};
|
|
144
|
+
export type FrameItemProperty = BaseItemProperty & {
|
|
145
|
+
layoutMode: FrameLayoutMode;
|
|
146
|
+
children: string[];
|
|
147
|
+
autoLayoutConfig?: AutoLayoutConfig;
|
|
148
|
+
layoutInfos?: Record<string, LayoutInfo>;
|
|
149
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 元素图层操作动作(旧 SDK 兼容枚举,对应新 item.reorder 的 reorderType 字符串)。
|
|
3
|
+
*
|
|
4
|
+
* 新代码建议直接使用字符串字面量:
|
|
5
|
+
* 'bringToFront' | 'sendToBack' | 'bringForward'(moveUp)| 'sendBackward'(moveDown)。
|
|
6
|
+
*/
|
|
7
|
+
export declare enum ItemOrderAction {
|
|
8
|
+
BringToFront = 0,
|
|
9
|
+
SendToBack = 1,
|
|
10
|
+
BringForward = 2,
|
|
11
|
+
SendBackward = 3
|
|
12
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { type spec } from '../../shared';
|
|
2
|
+
import { type AutoLayoutConfig, type LayoutInfo, type FrameLayoutMode } from './frame';
|
|
3
|
+
import { type CardHTML } from './item-property';
|
|
4
|
+
import { GeneratorType, type ItemCreateInfo } from './item-create-info';
|
|
5
|
+
import { ArtisItemType } from '../item';
|
|
6
|
+
/**
|
|
7
|
+
* 图片元素 Schema
|
|
8
|
+
*/
|
|
9
|
+
export type SpriteItemSchema = {
|
|
10
|
+
type: ArtisItemType.SPRITE;
|
|
11
|
+
id?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
parentId?: string;
|
|
14
|
+
extension?: Record<string, unknown>;
|
|
15
|
+
property: {
|
|
16
|
+
/** 图片资源地址 */
|
|
17
|
+
image?: string;
|
|
18
|
+
/** 像素宽度(不传 → auto 模式占位 300,资源就绪后按原生尺寸回写) */
|
|
19
|
+
width?: number;
|
|
20
|
+
/** 像素高度(不传 → auto 模式占位 300,资源就绪后按原生尺寸回写) */
|
|
21
|
+
height?: number;
|
|
22
|
+
/** 元素位置,缺省 [0,0] */
|
|
23
|
+
position?: [number, number];
|
|
24
|
+
/** 旋转角度 z | [x, y, z] */
|
|
25
|
+
rotation?: number | [number, number, number];
|
|
26
|
+
/** 缩放 */
|
|
27
|
+
scale?: [number, number];
|
|
28
|
+
/** 尺寸模式:不传则由 width/height 是否指定推导(任一缺省 → auto) */
|
|
29
|
+
sizeMode?: 'auto' | 'fixed';
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* 文本元素 Schema
|
|
34
|
+
*/
|
|
35
|
+
export type TextItemSchema = {
|
|
36
|
+
type: ArtisItemType.TEXT;
|
|
37
|
+
id?: string;
|
|
38
|
+
name?: string;
|
|
39
|
+
parentId?: string;
|
|
40
|
+
extension?: Record<string, unknown>;
|
|
41
|
+
property: {
|
|
42
|
+
/** 像素宽度 */
|
|
43
|
+
width: number;
|
|
44
|
+
/** 像素高度 */
|
|
45
|
+
height?: number;
|
|
46
|
+
/** 元素位置 */
|
|
47
|
+
position: [number, number];
|
|
48
|
+
/** 旋转角度 z | [x, y, z] */
|
|
49
|
+
rotation?: number | [number, number, number];
|
|
50
|
+
/** 缩放 */
|
|
51
|
+
scale?: [number, number];
|
|
52
|
+
/** 文本内容 */
|
|
53
|
+
text: string;
|
|
54
|
+
/** 字体大小 */
|
|
55
|
+
fontSize: number;
|
|
56
|
+
/** 字体名称 */
|
|
57
|
+
fontFamily: string;
|
|
58
|
+
/** 单行高度 */
|
|
59
|
+
lineHeight: number;
|
|
60
|
+
/** 填充色 [r, g, b, a] */
|
|
61
|
+
color: [number, number, number, number];
|
|
62
|
+
/** 字重 */
|
|
63
|
+
fontWeight?: spec.TextWeight;
|
|
64
|
+
/** 字体格式 */
|
|
65
|
+
fontStyle?: spec.FontStyle;
|
|
66
|
+
/** 对齐方式 */
|
|
67
|
+
textAlign?: spec.TextAlignment;
|
|
68
|
+
/** 描边色 [r, g, b, a] */
|
|
69
|
+
outlineColor?: [number, number, number, number];
|
|
70
|
+
/** 描边宽度 */
|
|
71
|
+
outlineWidth?: number;
|
|
72
|
+
/** 描边开关 */
|
|
73
|
+
outlineEnabled?: boolean;
|
|
74
|
+
/** 字体文件地址 */
|
|
75
|
+
fontUrl?: string;
|
|
76
|
+
/** 文本字间距 */
|
|
77
|
+
letterSpacing?: number;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* 视频元素 Schema
|
|
82
|
+
*/
|
|
83
|
+
export type VideoItemSchema = {
|
|
84
|
+
type: ArtisItemType.VIDEO;
|
|
85
|
+
id?: string;
|
|
86
|
+
name?: string;
|
|
87
|
+
parentId?: string;
|
|
88
|
+
extension?: Record<string, unknown>;
|
|
89
|
+
property: {
|
|
90
|
+
/** 视频资源地址 */
|
|
91
|
+
video?: string;
|
|
92
|
+
/** 像素宽度(不传 → auto 模式占位 400,资源就绪后按原生尺寸回写) */
|
|
93
|
+
width?: number;
|
|
94
|
+
/** 像素高度(不传 → auto 模式占位 300,资源就绪后按原生尺寸回写) */
|
|
95
|
+
height?: number;
|
|
96
|
+
/** 元素位置,缺省 [0,0] */
|
|
97
|
+
position?: [number, number];
|
|
98
|
+
/** 旋转角度 z | [x, y, z] */
|
|
99
|
+
rotation?: number | [number, number, number];
|
|
100
|
+
/** 缩放 */
|
|
101
|
+
scale?: [number, number];
|
|
102
|
+
/** 是否静音 */
|
|
103
|
+
muted?: boolean;
|
|
104
|
+
/** 是否为透明视频 */
|
|
105
|
+
transparent?: boolean;
|
|
106
|
+
/** 播放速率 */
|
|
107
|
+
playbackRate?: number;
|
|
108
|
+
/** 音量 */
|
|
109
|
+
volume?: number;
|
|
110
|
+
/** 尺寸模式:不传则由 width/height 是否指定推导(任一缺省 → auto) */
|
|
111
|
+
sizeMode?: 'auto' | 'fixed';
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* 空节点/组元素 Schema
|
|
116
|
+
*/
|
|
117
|
+
export type GroupItemSchema = {
|
|
118
|
+
type: ArtisItemType.GROUP;
|
|
119
|
+
id?: string;
|
|
120
|
+
name?: string;
|
|
121
|
+
parentId?: string;
|
|
122
|
+
extension?: Record<string, unknown>;
|
|
123
|
+
property: {
|
|
124
|
+
/** 元素位置 */
|
|
125
|
+
position?: [number, number];
|
|
126
|
+
/** 旋转角度 z | [x, y, z] */
|
|
127
|
+
rotation?: number | [number, number, number];
|
|
128
|
+
/** 缩放 */
|
|
129
|
+
scale?: [number, number];
|
|
130
|
+
/** 子元素 ID 列表 */
|
|
131
|
+
children: string[];
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* 资源生成器元素 Schema
|
|
136
|
+
*/
|
|
137
|
+
export type GeneratorItemSchema = {
|
|
138
|
+
type: ArtisItemType.GENERATOR;
|
|
139
|
+
id?: string;
|
|
140
|
+
name?: string;
|
|
141
|
+
parentId?: string;
|
|
142
|
+
extension?: Record<string, unknown>;
|
|
143
|
+
property: {
|
|
144
|
+
/** 生成器类型 */
|
|
145
|
+
generatorType: GeneratorType;
|
|
146
|
+
/** 像素宽度 */
|
|
147
|
+
width: number;
|
|
148
|
+
/** 像素高度 */
|
|
149
|
+
height: number;
|
|
150
|
+
/** 元素位置 */
|
|
151
|
+
position: [number, number];
|
|
152
|
+
/** 旋转角度 z | [x, y, z] */
|
|
153
|
+
rotation?: number | [number, number, number];
|
|
154
|
+
/** 缩放 */
|
|
155
|
+
scale?: [number, number];
|
|
156
|
+
/**
|
|
157
|
+
* 资源 URL(可选)。存在时 createItemCore 短路直建 sprite/video(不经生成器中间态):
|
|
158
|
+
* image 生成器→sprite(image=url),video 生成器→video(video=url)。
|
|
159
|
+
* 缺省时建空生成器占位,行为不变。
|
|
160
|
+
*/
|
|
161
|
+
resourceUrl?: string;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* 特效产物元素 Schema
|
|
166
|
+
*/
|
|
167
|
+
export type EffectsItemSchema = {
|
|
168
|
+
type: ArtisItemType.EFFECTS;
|
|
169
|
+
id?: string;
|
|
170
|
+
name?: string;
|
|
171
|
+
parentId?: string;
|
|
172
|
+
extension?: Record<string, unknown>;
|
|
173
|
+
property: {
|
|
174
|
+
/** 像素宽度 */
|
|
175
|
+
width?: number;
|
|
176
|
+
/** 像素高度 */
|
|
177
|
+
height?: number;
|
|
178
|
+
/** 元素位置 */
|
|
179
|
+
position: [number, number];
|
|
180
|
+
/** 旋转角度 z | [x, y, z] */
|
|
181
|
+
rotation?: number | [number, number, number];
|
|
182
|
+
/** 缩放 */
|
|
183
|
+
scale?: [number, number];
|
|
184
|
+
/** 特效资源地址 */
|
|
185
|
+
effects?: string;
|
|
186
|
+
/** 是否自适应大小(只读,初值在 create 期锁定后不再改) */
|
|
187
|
+
autoFit?: boolean;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* 画板/框架元素 Schema
|
|
192
|
+
*/
|
|
193
|
+
export type FrameItemSchema = {
|
|
194
|
+
type: ArtisItemType.FRAME;
|
|
195
|
+
id?: string;
|
|
196
|
+
name?: string;
|
|
197
|
+
parentId?: string;
|
|
198
|
+
extension?: Record<string, unknown>;
|
|
199
|
+
property: {
|
|
200
|
+
/** 像素宽度 */
|
|
201
|
+
width: number;
|
|
202
|
+
/** 像素高度 */
|
|
203
|
+
height: number;
|
|
204
|
+
/** 元素位置 */
|
|
205
|
+
position: [number, number];
|
|
206
|
+
/** 旋转角度 z | [x, y, z] */
|
|
207
|
+
rotation?: number | [number, number, number];
|
|
208
|
+
/** 缩放 */
|
|
209
|
+
scale?: [number, number];
|
|
210
|
+
/** 布局模式 */
|
|
211
|
+
layoutMode?: FrameLayoutMode;
|
|
212
|
+
/** 子元素 ID 列表 */
|
|
213
|
+
children: string[];
|
|
214
|
+
/** 自动布局配置 */
|
|
215
|
+
autoLayoutConfig?: AutoLayoutConfig;
|
|
216
|
+
/** 子元素布局信息 */
|
|
217
|
+
layoutInfos?: Record<string, LayoutInfo>;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* 卡片元素 Schema
|
|
222
|
+
*/
|
|
223
|
+
export type CardItemSchema = {
|
|
224
|
+
type: ArtisItemType.CARD;
|
|
225
|
+
id?: string;
|
|
226
|
+
name?: string;
|
|
227
|
+
parentId?: string;
|
|
228
|
+
extension?: Record<string, unknown>;
|
|
229
|
+
property: {
|
|
230
|
+
/** 卡片类型 */
|
|
231
|
+
cardType: string;
|
|
232
|
+
/** 像素宽度 */
|
|
233
|
+
width: number;
|
|
234
|
+
/** 像素高度 */
|
|
235
|
+
height: number;
|
|
236
|
+
/** 元素位置 */
|
|
237
|
+
position: [number, number];
|
|
238
|
+
/** 旋转角度 z | [x, y, z] */
|
|
239
|
+
rotation?: number | [number, number, number];
|
|
240
|
+
/** 缩放 */
|
|
241
|
+
scale?: [number, number];
|
|
242
|
+
/** 是否自动高度 */
|
|
243
|
+
autoHeight?: boolean;
|
|
244
|
+
/** HTML 内容配置 */
|
|
245
|
+
html?: CardHTML;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* 统一的元素 Schema(联合类型)
|
|
250
|
+
*
|
|
251
|
+
* 由此驱动:
|
|
252
|
+
* 1. 同步创建 ArtisItem + Player VFXItem
|
|
253
|
+
* 2. 异步加载资源(image / video / effects)
|
|
254
|
+
*/
|
|
255
|
+
export type ItemSchema = SpriteItemSchema | TextItemSchema | VideoItemSchema | GroupItemSchema | GeneratorItemSchema | EffectsItemSchema | FrameItemSchema | CardItemSchema;
|
|
256
|
+
/**
|
|
257
|
+
* 将外部 API 入参 ItemCreateInfo 转换为内部 ItemSchema
|
|
258
|
+
*
|
|
259
|
+
* ItemCreateInfo 是 ArtisSDK 对外暴露的创建参数类型,
|
|
260
|
+
* ItemSchema 是内部实现使用的统一数据结构。
|
|
261
|
+
* 两者字段基本一致,主要差异在 extension 类型(any → unknown)和部分可选字段。
|
|
262
|
+
*/
|
|
263
|
+
export declare function createInfoToItemSchema(createInfo: ItemCreateInfo): ItemSchema;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { spec } from '../../shared';
|
|
2
|
+
import { ArtisItemType } from '../item';
|
|
3
|
+
import type { SpriteItemProperty, TextItemProperty, VideoItemProperty, GroupItemProperty, GeneratorItemProperty, EffectsItemProperty, FrameItemProperty, CardItemProperty } from './item-property';
|
|
4
|
+
export declare enum BaseItemPropertyKey {
|
|
5
|
+
NAME = "name",
|
|
6
|
+
DURATION = "duration",
|
|
7
|
+
DELAY = "delay",
|
|
8
|
+
END_BEHAVIOR = "endBehavior",
|
|
9
|
+
VISIBLE = "visible",
|
|
10
|
+
IS_LOCKED = "isLocked",
|
|
11
|
+
PARENT_ID = "parentId"
|
|
12
|
+
}
|
|
13
|
+
export type BaseItemPropertyValueMap = {
|
|
14
|
+
name: string;
|
|
15
|
+
duration: number;
|
|
16
|
+
delay: number;
|
|
17
|
+
endBehavior: spec.EndBehavior;
|
|
18
|
+
visible: boolean;
|
|
19
|
+
isLocked: boolean;
|
|
20
|
+
parentId?: string;
|
|
21
|
+
};
|
|
22
|
+
export type ItemPropertyMap = {
|
|
23
|
+
[ArtisItemType.SPRITE]: SpriteItemProperty;
|
|
24
|
+
[ArtisItemType.TEXT]: TextItemProperty;
|
|
25
|
+
[ArtisItemType.VIDEO]: VideoItemProperty;
|
|
26
|
+
[ArtisItemType.GROUP]: GroupItemProperty;
|
|
27
|
+
[ArtisItemType.GENERATOR]: GeneratorItemProperty;
|
|
28
|
+
[ArtisItemType.EFFECTS]: EffectsItemProperty;
|
|
29
|
+
[ArtisItemType.FRAME]: FrameItemProperty;
|
|
30
|
+
[ArtisItemType.CARD]: CardItemProperty;
|
|
31
|
+
};
|
|
32
|
+
export type SetSingleItemSinglePropertyParam<T extends ArtisItemType = ArtisItemType> = {
|
|
33
|
+
itemId: string;
|
|
34
|
+
type: T;
|
|
35
|
+
propertyName: BaseItemPropertyKey;
|
|
36
|
+
propertyValue: BaseItemPropertyValueMap[BaseItemPropertyKey];
|
|
37
|
+
} | {
|
|
38
|
+
itemId: string;
|
|
39
|
+
type: T;
|
|
40
|
+
propertyName: keyof ItemPropertyMap[T];
|
|
41
|
+
propertyValue: ItemPropertyMap[T][keyof ItemPropertyMap[T]];
|
|
42
|
+
};
|
|
43
|
+
export type SetSingleItemMultiplePropertiesParam<T extends ArtisItemType = ArtisItemType> = {
|
|
44
|
+
itemId: string;
|
|
45
|
+
type: T;
|
|
46
|
+
property: Partial<Record<BaseItemPropertyKey, BaseItemPropertyValueMap[BaseItemPropertyKey]>> & Partial<Record<keyof ItemPropertyMap[T], ItemPropertyMap[T][keyof ItemPropertyMap[T]]>>;
|
|
47
|
+
};
|
|
48
|
+
export type SetItemPropertyParam<T extends ArtisItemType = ArtisItemType> = SetSingleItemSinglePropertyParam<T> | SetSingleItemMultiplePropertiesParam<T>;
|