mce 0.24.3 → 0.25.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/README.md +237 -4
- package/dist/components/EditorPanels.vue.d.ts +6 -0
- package/dist/components/Interactions.vue.d.ts +3 -0
- package/dist/components/shared/Cropper.vue.d.ts +5 -1
- package/dist/components/shared/Dialog.vue.d.ts +33 -38
- package/dist/components/shared/FloatPanel.vue.d.ts +4 -2
- package/dist/components/shared/LayoutItem.vue.d.ts +29 -0
- package/dist/components/shared/PanelContent.vue.d.ts +29 -0
- package/dist/components/timeline/EasingCurve.vue.d.ts +11 -0
- package/dist/components/timeline/KeyframePopover.vue.d.ts +3 -0
- package/dist/crdt/YDoc.d.ts +27 -2
- package/dist/crdt/YDoc.test.d.ts +1 -0
- package/dist/crdt/index.d.ts +3 -0
- package/dist/crdt/providers/indexeddb/IndexeddbProvider.d.ts +3 -1
- package/dist/crdt/reactivity.d.ts +27 -0
- package/dist/crdt/reactivity.test.d.ts +1 -0
- package/dist/crdt/vueReactivity.d.ts +8 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +10300 -8946
- package/dist/locale/en.d.ts +51 -9
- package/dist/locale/zh-Hans.d.ts +51 -9
- package/dist/mixins/0.context.d.ts +2 -0
- package/dist/mixins/extensions.d.ts +105 -0
- package/dist/mixins/panels.d.ts +46 -0
- package/dist/plugin.d.ts +14 -0
- package/dist/plugins/animate.d.ts +40 -0
- package/dist/plugins/components.d.ts +32 -0
- package/dist/plugins/flexLayout.d.ts +15 -0
- package/dist/plugins/history.d.ts +2 -0
- package/dist/plugins/interactions.d.ts +44 -0
- package/dist/plugins/shape.d.ts +0 -4
- package/dist/plugins/slice.d.ts +10 -0
- package/dist/plugins/smartGuides.d.ts +2 -2
- package/dist/plugins/timeline.d.ts +17 -0
- package/dist/plugins/toolbelt.d.ts +4 -0
- package/dist/plugins/variables.d.ts +27 -0
- package/dist/plugins/zoom.d.ts +2 -0
- package/dist/scene/Doc.d.ts +13 -1
- package/dist/typed-global.d.ts +6 -2
- package/dist/typed-plugins.d.ts +6 -3
- package/dist/utils/animationPresets.d.ts +27 -0
- package/dist/utils/components.d.ts +33 -0
- package/dist/utils/components.test.d.ts +1 -0
- package/dist/utils/create.d.ts +1 -15
- package/dist/utils/easing.d.ts +23 -0
- package/dist/utils/easing.test.d.ts +1 -0
- package/dist/utils/index.d.ts +8 -1
- package/dist/utils/keyframes.d.ts +31 -0
- package/dist/utils/keyframes.test.d.ts +1 -0
- package/dist/utils/lottie.d.ts +27 -0
- package/dist/utils/lottie.test.d.ts +1 -0
- package/dist/utils/remapTextSelection.d.ts +23 -0
- package/dist/utils/remapTextSelection.test.d.ts +1 -0
- package/dist/utils/traverse.d.ts +9 -0
- package/dist/utils/variables.d.ts +58 -0
- package/dist/utils/variables.test.d.ts +1 -0
- package/package.json +4 -8
- package/dist/plugins/html.d.ts +0 -2
- package/dist/plugins/table.d.ts +0 -2
- package/dist/plugins/workflow.d.ts +0 -31
- package/dist/utils/table.d.ts +0 -93
- package/dist/utils/workflow.d.ts +0 -9
- /package/dist/components/{TableEditor.vue.d.ts → Components.vue.d.ts} +0 -0
- /package/dist/components/{Workflow.vue.d.ts → InteractionBadges.vue.d.ts} +0 -0
- /package/dist/utils/{smartGuides-geometry.d.ts → smartGuidesGeometry.d.ts} +0 -0
package/dist/locale/en.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ declare const _default: {
|
|
|
8
8
|
painting: string;
|
|
9
9
|
selecting: string;
|
|
10
10
|
cropping: string;
|
|
11
|
-
tableEditing: string;
|
|
12
11
|
selectObject: string;
|
|
13
12
|
commitChanges: string;
|
|
14
13
|
extend: string;
|
|
@@ -30,10 +29,6 @@ declare const _default: {
|
|
|
30
29
|
ellipse: string;
|
|
31
30
|
polygon: string;
|
|
32
31
|
star: string;
|
|
33
|
-
table: string;
|
|
34
|
-
chartBar: string;
|
|
35
|
-
chartLine: string;
|
|
36
|
-
chartPie: string;
|
|
37
32
|
image: string;
|
|
38
33
|
video: string;
|
|
39
34
|
lottie: string;
|
|
@@ -71,7 +66,6 @@ declare const _default: {
|
|
|
71
66
|
view: string;
|
|
72
67
|
mode: string;
|
|
73
68
|
'mode:canvas': string;
|
|
74
|
-
'mode:workflow': string;
|
|
75
69
|
checkerboard: string;
|
|
76
70
|
pixelGrid: string;
|
|
77
71
|
ruler: string;
|
|
@@ -80,6 +74,7 @@ declare const _default: {
|
|
|
80
74
|
'checkerboard:grid': string;
|
|
81
75
|
'checkerboard:dot': string;
|
|
82
76
|
panels: string;
|
|
77
|
+
components: string;
|
|
83
78
|
timeline: string;
|
|
84
79
|
play: string;
|
|
85
80
|
pause: string;
|
|
@@ -89,11 +84,58 @@ declare const _default: {
|
|
|
89
84
|
stepBackward: string;
|
|
90
85
|
stepForward: string;
|
|
91
86
|
collapse: string;
|
|
87
|
+
removeKeyframe: string;
|
|
88
|
+
custom: string;
|
|
89
|
+
saveEasingPreset: string;
|
|
90
|
+
playbackRate: string;
|
|
91
|
+
loopMode: string;
|
|
92
|
+
loopOnce: string;
|
|
93
|
+
loopAll: string;
|
|
94
|
+
loopPingpong: string;
|
|
95
|
+
addAnimation: string;
|
|
96
|
+
removeAnimation: string;
|
|
97
|
+
animationItem: string;
|
|
98
|
+
animGroupIn: string;
|
|
99
|
+
animGroupOut: string;
|
|
100
|
+
animGroupEmphasis: string;
|
|
101
|
+
fadeIn: string;
|
|
102
|
+
slideInLeft: string;
|
|
103
|
+
slideInRight: string;
|
|
104
|
+
slideInUp: string;
|
|
105
|
+
slideInDown: string;
|
|
106
|
+
popIn: string;
|
|
107
|
+
fadeOut: string;
|
|
108
|
+
slideOutDown: string;
|
|
109
|
+
pulse: string;
|
|
110
|
+
spin: string;
|
|
111
|
+
interactions: string;
|
|
112
|
+
preview: string;
|
|
113
|
+
exitPreview: string;
|
|
114
|
+
previewExitHint: string;
|
|
115
|
+
interactionsSelectHint: string;
|
|
116
|
+
addInteraction: string;
|
|
117
|
+
removeInteraction: string;
|
|
118
|
+
targetFrame: string;
|
|
119
|
+
trigger_click: string;
|
|
120
|
+
trigger_pointerEnter: string;
|
|
121
|
+
trigger_pointerLeave: string;
|
|
122
|
+
trigger_load: string;
|
|
123
|
+
trigger_scrollIntoView: string;
|
|
124
|
+
selectVariable: string;
|
|
125
|
+
variableValue: string;
|
|
126
|
+
conditionWhen: string;
|
|
127
|
+
conditionAlways: string;
|
|
128
|
+
scrollDriven: string;
|
|
129
|
+
action_setVariable: string;
|
|
130
|
+
action_restart: string;
|
|
131
|
+
action_play: string;
|
|
132
|
+
action_pause: string;
|
|
133
|
+
action_toggle: string;
|
|
134
|
+
action_navigate: string;
|
|
135
|
+
action_openUrl: string;
|
|
136
|
+
action_toggleVisible: string;
|
|
92
137
|
statusbar: string;
|
|
93
138
|
creator: string;
|
|
94
|
-
'workflow:text': string;
|
|
95
|
-
'workflow:image': string;
|
|
96
|
-
'workflow:video': string;
|
|
97
139
|
memoryManager: string;
|
|
98
140
|
toolbelt: string;
|
|
99
141
|
msaa: string;
|
package/dist/locale/zh-Hans.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ declare const _default: {
|
|
|
8
8
|
painting: string;
|
|
9
9
|
selecting: string;
|
|
10
10
|
cropping: string;
|
|
11
|
-
tableEditing: string;
|
|
12
11
|
selectObject: string;
|
|
13
12
|
commitChanges: string;
|
|
14
13
|
extend: string;
|
|
@@ -30,10 +29,6 @@ declare const _default: {
|
|
|
30
29
|
ellipse: string;
|
|
31
30
|
polygon: string;
|
|
32
31
|
star: string;
|
|
33
|
-
table: string;
|
|
34
|
-
chartBar: string;
|
|
35
|
-
chartLine: string;
|
|
36
|
-
chartPie: string;
|
|
37
32
|
image: string;
|
|
38
33
|
video: string;
|
|
39
34
|
lottie: string;
|
|
@@ -71,7 +66,6 @@ declare const _default: {
|
|
|
71
66
|
view: string;
|
|
72
67
|
mode: string;
|
|
73
68
|
'mode:canvas': string;
|
|
74
|
-
'mode:workflow': string;
|
|
75
69
|
checkerboard: string;
|
|
76
70
|
pixelGrid: string;
|
|
77
71
|
ruler: string;
|
|
@@ -80,6 +74,7 @@ declare const _default: {
|
|
|
80
74
|
'checkerboard:grid': string;
|
|
81
75
|
'checkerboard:dot': string;
|
|
82
76
|
panels: string;
|
|
77
|
+
components: string;
|
|
83
78
|
statusbar: string;
|
|
84
79
|
timeline: string;
|
|
85
80
|
play: string;
|
|
@@ -90,10 +85,57 @@ declare const _default: {
|
|
|
90
85
|
stepBackward: string;
|
|
91
86
|
stepForward: string;
|
|
92
87
|
collapse: string;
|
|
88
|
+
removeKeyframe: string;
|
|
89
|
+
custom: string;
|
|
90
|
+
saveEasingPreset: string;
|
|
91
|
+
playbackRate: string;
|
|
92
|
+
loopMode: string;
|
|
93
|
+
loopOnce: string;
|
|
94
|
+
loopAll: string;
|
|
95
|
+
loopPingpong: string;
|
|
96
|
+
addAnimation: string;
|
|
97
|
+
removeAnimation: string;
|
|
98
|
+
animationItem: string;
|
|
99
|
+
animGroupIn: string;
|
|
100
|
+
animGroupOut: string;
|
|
101
|
+
animGroupEmphasis: string;
|
|
102
|
+
fadeIn: string;
|
|
103
|
+
slideInLeft: string;
|
|
104
|
+
slideInRight: string;
|
|
105
|
+
slideInUp: string;
|
|
106
|
+
slideInDown: string;
|
|
107
|
+
popIn: string;
|
|
108
|
+
fadeOut: string;
|
|
109
|
+
slideOutDown: string;
|
|
110
|
+
pulse: string;
|
|
111
|
+
spin: string;
|
|
112
|
+
interactions: string;
|
|
113
|
+
preview: string;
|
|
114
|
+
exitPreview: string;
|
|
115
|
+
previewExitHint: string;
|
|
116
|
+
interactionsSelectHint: string;
|
|
117
|
+
addInteraction: string;
|
|
118
|
+
removeInteraction: string;
|
|
119
|
+
targetFrame: string;
|
|
120
|
+
trigger_click: string;
|
|
121
|
+
trigger_pointerEnter: string;
|
|
122
|
+
trigger_pointerLeave: string;
|
|
123
|
+
trigger_load: string;
|
|
124
|
+
trigger_scrollIntoView: string;
|
|
125
|
+
selectVariable: string;
|
|
126
|
+
variableValue: string;
|
|
127
|
+
conditionWhen: string;
|
|
128
|
+
conditionAlways: string;
|
|
129
|
+
scrollDriven: string;
|
|
130
|
+
action_setVariable: string;
|
|
131
|
+
action_restart: string;
|
|
132
|
+
action_play: string;
|
|
133
|
+
action_pause: string;
|
|
134
|
+
action_toggle: string;
|
|
135
|
+
action_navigate: string;
|
|
136
|
+
action_openUrl: string;
|
|
137
|
+
action_toggleVisible: string;
|
|
93
138
|
creator: string;
|
|
94
|
-
'workflow:text': string;
|
|
95
|
-
'workflow:image': string;
|
|
96
|
-
'workflow:video': string;
|
|
97
139
|
memoryManager: string;
|
|
98
140
|
toolbelt: string;
|
|
99
141
|
msaa: string;
|
|
@@ -50,6 +50,8 @@ declare global {
|
|
|
50
50
|
getGlobalPointer: () => Vector2Like;
|
|
51
51
|
parseAnchor: (anchor: Anchor, isRtl?: boolean) => ParsedAnchor;
|
|
52
52
|
isNode: (value: any) => value is Node;
|
|
53
|
+
/** 按 id 取节点:走 SceneTree 的 nodeMap(随 nodeEnter/nodeExit 增量维护),O(1) 且始终最新。 */
|
|
54
|
+
getNodeById: (id: string) => Node | undefined;
|
|
53
55
|
isRootNode: (node: Node) => boolean;
|
|
54
56
|
isFrameNode: (node: Node, isTop?: boolean) => boolean;
|
|
55
57
|
inEditorIs: (node: Node, inEditorIs?: EditorNodeType) => boolean;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { Element2D } from 'modern-canvas';
|
|
2
|
+
import type { Component, Ref } from 'vue';
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Mce {
|
|
5
|
+
/**
|
|
6
|
+
* 把命中的节点重定向到真正应被选中的节点(如表格单元格 → 表格元素)。
|
|
7
|
+
* 返回 undefined 表示不改写。由插件注册,供选择 / 悬停策略统一应用。
|
|
8
|
+
*/
|
|
9
|
+
type SelectionRedirect = (node: Element2D, editor: Editor) => Element2D | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* 自定义某元素的缩放行为(如表格按行列网格重算尺寸而非整体缩放)。
|
|
12
|
+
* 返回 true 表示已处理、跳过默认缩放;返回 false 走默认。
|
|
13
|
+
*/
|
|
14
|
+
interface ResizeOverrideContext {
|
|
15
|
+
scaleX: number;
|
|
16
|
+
scaleY: number;
|
|
17
|
+
newWidth: number;
|
|
18
|
+
newHeight: number;
|
|
19
|
+
options: Mce.ResizeElementOptions;
|
|
20
|
+
}
|
|
21
|
+
type ResizeOverride = (element: Element2D, context: ResizeOverrideContext) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 进入元素编辑(Enter / 双击)。返回 true 表示已处理,停止后续 handler 与核心默认行为。
|
|
24
|
+
*/
|
|
25
|
+
type EnterHandler = (element: Element2D, editor: Editor) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* 插件向工具腰带(底部主工具栏)追加的一级按钮(如 @mce/comments 的评论工具)。
|
|
28
|
+
* 底部主工具栏:工具即按钮,带激活高亮 / tooltip / 快捷键提示。
|
|
29
|
+
*/
|
|
30
|
+
interface ToolbeltItem {
|
|
31
|
+
/** 图标 / i18n key:图标取 `$<key>`,tooltip 取 `t(key)`,快捷键提示按 key 推断。 */
|
|
32
|
+
key: string;
|
|
33
|
+
/** 自定义图标名(默认 `$<key>`)。 */
|
|
34
|
+
icon?: string;
|
|
35
|
+
/** 是否激活(高亮)。渲染时调用,读响应式状态即可自动更新。 */
|
|
36
|
+
isActive?: () => boolean;
|
|
37
|
+
/** 点击处理。 */
|
|
38
|
+
handle: () => void;
|
|
39
|
+
/** 放置在内置工具之前 / 之后(默认 after)。 */
|
|
40
|
+
placement?: 'before' | 'after';
|
|
41
|
+
}
|
|
42
|
+
interface Editor {
|
|
43
|
+
/** 选择重定向链。 */
|
|
44
|
+
selectionRedirects: SelectionRedirect[];
|
|
45
|
+
registerSelectionRedirect: (fn: SelectionRedirect) => void;
|
|
46
|
+
/** 依次应用所有重定向,得到最终应被选中的节点。 */
|
|
47
|
+
resolveSelectionRedirect: (node: Element2D | undefined) => Element2D | undefined;
|
|
48
|
+
/** 缩放行为覆盖链。 */
|
|
49
|
+
resizeOverrides: ResizeOverride[];
|
|
50
|
+
registerResizeOverride: (fn: ResizeOverride) => void;
|
|
51
|
+
/** 应用覆盖;返回 true 表示某插件已处理缩放。 */
|
|
52
|
+
applyResizeOverride: (element: Element2D, context: ResizeOverrideContext) => boolean;
|
|
53
|
+
/** 进入编辑处理链。 */
|
|
54
|
+
enterHandlers: EnterHandler[];
|
|
55
|
+
registerEnterHandler: (fn: EnterHandler) => void;
|
|
56
|
+
/**
|
|
57
|
+
* 内容编辑态集合:处于这些 state 时隐藏选择框 / 浮动条、抑制快捷键。
|
|
58
|
+
* 默认空;由插件注册自己的编辑态(如 table 注册 'tableEditing')。
|
|
59
|
+
* 注意:核心的 'typing' 不在此集合,仍按原有逻辑各处单独处理。
|
|
60
|
+
*/
|
|
61
|
+
editingStates: Set<string>;
|
|
62
|
+
registerEditingState: (state: string) => void;
|
|
63
|
+
/** 当前是否处于某个已注册的内容编辑态。 */
|
|
64
|
+
isContentEditing: () => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 插件向工具栏「形状」下拉追加的工具 key(如 @mce/table 的 'table'、@mce/chart 的图表)。
|
|
67
|
+
* key 同时是工具名(activateTool(key))与图标 / 文案 key。
|
|
68
|
+
*/
|
|
69
|
+
toolbeltShapeItems: Ref<string[]>;
|
|
70
|
+
registerToolbeltShapeItem: (key: string) => void;
|
|
71
|
+
/**
|
|
72
|
+
* 插件注册的图标:alias 名(不含 `$`)→ SVG path。会在 EditorLayout 创建图标集时
|
|
73
|
+
* 合并进 IconsSymbol 的 aliases,从而让 `$<name>` 可解析。供 @mce/table、@mce/chart
|
|
74
|
+
* 等把自己的图标随插件携带,核心图标集不再硬编码它们。
|
|
75
|
+
*/
|
|
76
|
+
icons: Ref<Record<string, string>>;
|
|
77
|
+
registerIcon: (name: string, path: string) => void;
|
|
78
|
+
/**
|
|
79
|
+
* 插件注册的编辑模式(除核心 'canvas' 外,如 @mce/workflow 的 'workflow')。
|
|
80
|
+
* 菜单的模式切换项据此生成;模式 UI 由插件以 overlay 组件按 mode 自行条件渲染。
|
|
81
|
+
*/
|
|
82
|
+
modes: Ref<string[]>;
|
|
83
|
+
registerMode: (mode: string) => void;
|
|
84
|
+
/**
|
|
85
|
+
* 插件向状态栏右侧追加的组件(如 @mce/collaboration 的连接状态 / 在场头像)。
|
|
86
|
+
* Statusbar 据此渲染,核心状态栏不再直接 import 插件组件。
|
|
87
|
+
*/
|
|
88
|
+
statusbarItems: Ref<Component[]>;
|
|
89
|
+
registerStatusbarItem: (component: Component) => void;
|
|
90
|
+
/**
|
|
91
|
+
* 插件向工具腰带追加的一级按钮(如 @mce/comments 的评论工具)。
|
|
92
|
+
* Toolbelt 据此渲染,核心不再硬编码插件工具。
|
|
93
|
+
*/
|
|
94
|
+
toolbeltItems: Ref<ToolbeltItem[]>;
|
|
95
|
+
registerToolbeltItem: (item: ToolbeltItem) => void;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 通用扩展点:让插件(如 @mce/table、@mce/chart)把原本硬编码在核心里的特例行为
|
|
101
|
+
* (选择重定向、缩放覆盖、进入编辑、内容编辑态)注册进来,从而把元素类型相关逻辑
|
|
102
|
+
* 从核心解耦出去。
|
|
103
|
+
*/
|
|
104
|
+
declare const _default: import("..").Mixin;
|
|
105
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Ref, WritableComputedRef } from 'vue';
|
|
2
|
+
declare global {
|
|
3
|
+
namespace Mce {
|
|
4
|
+
interface PanelTransform {
|
|
5
|
+
left: number;
|
|
6
|
+
top: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
interface PanelState {
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
/** 浮动面板位置 / 尺寸。 */
|
|
13
|
+
transform?: PanelTransform;
|
|
14
|
+
/** 停靠面板尺寸(宽或高,按 position)。 */
|
|
15
|
+
size?: number;
|
|
16
|
+
}
|
|
17
|
+
interface UIConfig {
|
|
18
|
+
/** 各面板的持久化运行时状态(显隐 / 浮动位置尺寸),按面板 name 索引。 */
|
|
19
|
+
panels: Record<string, PanelState>;
|
|
20
|
+
}
|
|
21
|
+
interface PanelsApi {
|
|
22
|
+
/** 面板显隐的可写引用(桥接到 config,统一数据源)。 */
|
|
23
|
+
visibleRef: (name: string) => WritableComputedRef<boolean>;
|
|
24
|
+
/** 浮动面板位置 / 尺寸的可写引用(持久化)。 */
|
|
25
|
+
transformRef: (name: string) => WritableComputedRef<PanelTransform | undefined>;
|
|
26
|
+
/** 停靠面板尺寸的可写引用(持久化)。 */
|
|
27
|
+
sizeRef: (name: string) => WritableComputedRef<number | undefined>;
|
|
28
|
+
/** 浮动面板层叠顺序(内存态,决定 z-index)。 */
|
|
29
|
+
floatOrder: Ref<string[]>;
|
|
30
|
+
/** 把某浮动面板提到最前。 */
|
|
31
|
+
bringToFront: (name: string) => void;
|
|
32
|
+
/** 浮动面板关闭时移出层叠栈。 */
|
|
33
|
+
release: (name: string) => void;
|
|
34
|
+
/** 某浮动面板当前 z-index。 */
|
|
35
|
+
floatZIndex: (name: string) => number;
|
|
36
|
+
/** 写入浮动面板位置 / 尺寸(自动做画布边界约束)。 */
|
|
37
|
+
setTransform: (name: string, transform: PanelTransform) => void;
|
|
38
|
+
}
|
|
39
|
+
interface Editor {
|
|
40
|
+
/** 面板运行时状态的单一数据源(float 与 dock 共用)。 */
|
|
41
|
+
panels: PanelsApi;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
declare const _default: import("..").Mixin;
|
|
46
|
+
export default _default;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ export interface PluginPanelComponent extends PluginBaseComponent {
|
|
|
11
11
|
name: string;
|
|
12
12
|
position: 'float' | 'top' | 'right' | 'bottom' | 'left';
|
|
13
13
|
size?: number;
|
|
14
|
+
/** 停靠面板是否可拖拽调整尺寸(默认 true;细条如 statusbar 设 false)。 */
|
|
15
|
+
resizable?: boolean;
|
|
16
|
+
/** 停靠面板拖拽尺寸下限 / 上限。 */
|
|
17
|
+
minSize?: number;
|
|
18
|
+
maxSize?: number;
|
|
14
19
|
}
|
|
15
20
|
export interface PluginDialogComponent extends PluginBaseComponent {
|
|
16
21
|
type: 'dialog';
|
|
@@ -19,6 +24,15 @@ export interface PluginOverlayComponent extends PluginBaseComponent {
|
|
|
19
24
|
type: 'overlay';
|
|
20
25
|
}
|
|
21
26
|
export type PluginComponent = PluginOverlayComponent | PluginDialogComponent | PluginPanelComponent;
|
|
27
|
+
export declare function isPanelComponent<T extends {
|
|
28
|
+
type?: string;
|
|
29
|
+
}>(c: T): c is T & PluginPanelComponent;
|
|
30
|
+
export declare function isOverlayComponent<T extends {
|
|
31
|
+
type?: string;
|
|
32
|
+
}>(c: T): c is T & PluginOverlayComponent;
|
|
33
|
+
export declare function isDialogComponent<T extends {
|
|
34
|
+
type?: string;
|
|
35
|
+
}>(c: T): c is T & PluginDialogComponent;
|
|
22
36
|
export interface PluginObject {
|
|
23
37
|
name: string;
|
|
24
38
|
ignore?: () => boolean;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Element2D } from 'modern-canvas';
|
|
2
|
+
import type { Keyframe } from '../utils';
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Mce {
|
|
5
|
+
interface ExportLottieOptions {
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
fps?: number;
|
|
9
|
+
}
|
|
10
|
+
interface AnimationTiming {
|
|
11
|
+
duration?: number;
|
|
12
|
+
delay?: number;
|
|
13
|
+
}
|
|
14
|
+
interface Commands {
|
|
15
|
+
getElementKeyframes: (node?: Element2D) => Keyframe[];
|
|
16
|
+
/** 在指定时间点(offset 0..1)插入 / 更新关键帧(合并 props)。 */
|
|
17
|
+
addAnimationKeyframe: (offset: number, props: Record<string, any>, node?: Element2D) => void;
|
|
18
|
+
removeAnimationKeyframe: (offset: number, node?: Element2D) => void;
|
|
19
|
+
setAnimationKeyframeEasing: (offset: number, easing: string, node?: Element2D) => void;
|
|
20
|
+
setAnimationTiming: (timing: AnimationTiming, node?: Element2D) => void;
|
|
21
|
+
/** 应用预设动画(进入 / 退出 / 强调),按元素当前样式生成关键帧;同类预设会被替换。 */
|
|
22
|
+
applyAnimationPreset: (id: string, node?: Element2D) => void;
|
|
23
|
+
/** 独立播放某元素自身的动画(脱离全局时间轴,各元素各自计时)。restart 从头播,否则续播。 */
|
|
24
|
+
playElementAnimation: (node?: Element2D, restart?: boolean) => void;
|
|
25
|
+
/** 暂停某元素的独立播放,冻结在当前帧。 */
|
|
26
|
+
pauseElementAnimation: (node?: Element2D) => void;
|
|
27
|
+
/** 切换某元素独立播放 / 暂停。 */
|
|
28
|
+
toggleElementAnimation: (node?: Element2D) => void;
|
|
29
|
+
/** 停止独立播放并恢复跟随全局时间轴。 */
|
|
30
|
+
stopElementAnimation: (node?: Element2D) => void;
|
|
31
|
+
/** 注册可复用的自定义缓动(名字 → cubic-bezier 字符串),存于文档。 */
|
|
32
|
+
registerEasing: (name: string, value: string) => void;
|
|
33
|
+
getEasings: () => Record<string, string>;
|
|
34
|
+
/** 把场景里所有带关键帧动画的元素导出为 Lottie JSON(transform / opacity 通道)。 */
|
|
35
|
+
exportLottie: (options?: ExportLottieOptions) => object;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
declare const _default: import("..").Plugin;
|
|
40
|
+
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Element2D, Node } from 'modern-canvas';
|
|
2
|
+
import type { ComponentDef } from '../utils';
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Mce {
|
|
5
|
+
interface CreateInstanceOptions {
|
|
6
|
+
position?: AddElementPosition;
|
|
7
|
+
parent?: Node;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface Commands {
|
|
11
|
+
/** 把选中(或指定)元素登记为组件 master,返回组件 id。 */
|
|
12
|
+
createComponent: (node?: Element2D) => string | undefined;
|
|
13
|
+
/** 从组件实例化一个 instance,返回实例元素 id。 */
|
|
14
|
+
createInstance: (componentId: string, options?: CreateInstanceOptions) => string | undefined;
|
|
15
|
+
/** 设置实例的路径级覆盖并重建该实例。 */
|
|
16
|
+
setInstanceOverride: (path: string, value: any, node?: Element2D) => void;
|
|
17
|
+
/** 解除实例与组件的关联,变回普通元素。 */
|
|
18
|
+
detachInstance: (node?: Element2D) => void;
|
|
19
|
+
/** 用某节点的当前内容更新组件 master,并传播到所有实例。 */
|
|
20
|
+
updateComponent: (componentId: string, node?: Element2D) => void;
|
|
21
|
+
/** 把某组件的所有实例按 master + 各自 override 重建。 */
|
|
22
|
+
syncInstancesOf: (componentId: string) => void;
|
|
23
|
+
getComponents: () => ComponentDef[];
|
|
24
|
+
/** 批量灌入预置组件(按 id 去重 / 覆盖),用于预设组件库 / 模板。 */
|
|
25
|
+
loadComponentPresets: (defs: ComponentDef[]) => void;
|
|
26
|
+
/** 从组件库移除一个组件定义(已落地的实例不受影响)。 */
|
|
27
|
+
removeComponent: (componentId: string) => void;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
declare const _default: import("..").Plugin;
|
|
32
|
+
export default _default;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
import type { FlexDirection } from 'modern-idoc';
|
|
2
|
+
declare global {
|
|
3
|
+
namespace Mce {
|
|
4
|
+
/** Container-level flex/auto-layout properties exposed to UI panels. */
|
|
5
|
+
type FlexStyleKey = 'flexDirection' | 'flexWrap' | 'justifyContent' | 'alignItems' | 'alignContent' | 'gap' | 'padding' | 'paddingTop' | 'paddingLeft' | 'paddingRight' | 'paddingBottom';
|
|
6
|
+
interface Commands {
|
|
7
|
+
enableFlexLayout: (direction?: FlexDirection) => void;
|
|
8
|
+
disableFlexLayout: () => void;
|
|
9
|
+
toggleFlexLayout: () => void;
|
|
10
|
+
isFlexLayout: () => boolean;
|
|
11
|
+
setFlexStyle: (key: FlexStyleKey, value: any) => void;
|
|
12
|
+
getFlexStyle: (key: FlexStyleKey) => any;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
1
16
|
/**
|
|
2
17
|
* Drag-to-reorder for children of a flex/auto-layout container.
|
|
3
18
|
*
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Element2D, Node } from 'modern-canvas';
|
|
2
|
+
import type { Ref } from 'vue';
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Mce {
|
|
5
|
+
type InteractionTrigger = 'click' | 'pointerEnter' | 'pointerLeave' | 'load' | 'scrollIntoView';
|
|
6
|
+
type InteractionAction = 'restart' | 'play' | 'pause' | 'toggle' | 'navigate' | 'openUrl' | 'toggleVisible' | 'setVariable';
|
|
7
|
+
type ConditionOp = '==' | '!=' | '>' | '<';
|
|
8
|
+
interface InteractionCondition {
|
|
9
|
+
variableId: string;
|
|
10
|
+
op: ConditionOp;
|
|
11
|
+
value: any;
|
|
12
|
+
}
|
|
13
|
+
interface Interaction {
|
|
14
|
+
id: string;
|
|
15
|
+
trigger: InteractionTrigger;
|
|
16
|
+
action: InteractionAction;
|
|
17
|
+
/** 目标元素 / 帧 id,缺省为触发元素自身。 */
|
|
18
|
+
target?: string;
|
|
19
|
+
url?: string;
|
|
20
|
+
frameId?: string;
|
|
21
|
+
variableId?: string;
|
|
22
|
+
value?: any;
|
|
23
|
+
/** 仅当条件成立才执行(轻量状态机:配合 setVariable)。 */
|
|
24
|
+
condition?: InteractionCondition;
|
|
25
|
+
}
|
|
26
|
+
interface Editor {
|
|
27
|
+
/** 预览(可交互)模式:开启后点击元素触发其交互,编辑操作被禁用。 */
|
|
28
|
+
previewMode: Ref<boolean>;
|
|
29
|
+
/** 交互数据变更计数(meta 写入非响应式,用它驱动 UI 刷新)。 */
|
|
30
|
+
interactionsRev: Ref<number>;
|
|
31
|
+
/** 滚动驱动:预览态下用滚轮进度驱动时间轴播放头(scrollytelling)。 */
|
|
32
|
+
scrollDriven: Ref<boolean>;
|
|
33
|
+
}
|
|
34
|
+
interface Commands {
|
|
35
|
+
getElementInteractions: (node?: Element2D) => Interaction[];
|
|
36
|
+
setElementInteractions: (interactions: Interaction[], node?: Element2D) => void;
|
|
37
|
+
togglePreview: () => void;
|
|
38
|
+
runInteraction: (interaction: Interaction, source: Node) => void;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export declare function createInteractionId(): string;
|
|
43
|
+
declare const _default: import("../plugin").Plugin;
|
|
44
|
+
export default _default;
|
package/dist/plugins/shape.d.ts
CHANGED
package/dist/plugins/slice.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Mce {
|
|
3
|
+
interface Commands {
|
|
4
|
+
exportSlice: (options: ExportOptions) => Promise<HTMLCanvasElement | undefined>;
|
|
5
|
+
}
|
|
6
|
+
interface Tools {
|
|
7
|
+
slice: [];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
1
11
|
declare const _default: import("..").Plugin;
|
|
2
12
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { BoundingBox, Box, Line, LinePair, LinePairType, LineType } from '../utils/
|
|
2
|
-
export { createLine, findDistancePairs, flipType, isLeftTopLine, toBoundingBox } from '../utils/
|
|
1
|
+
export type { BoundingBox, Box, Line, LinePair, LinePairType, LineType } from '../utils/smartGuidesGeometry';
|
|
2
|
+
export { createLine, findDistancePairs, flipType, isLeftTopLine, toBoundingBox } from '../utils/smartGuidesGeometry';
|
|
3
3
|
declare const _default: import("..").Plugin;
|
|
4
4
|
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Animation } from 'modern-canvas';
|
|
1
2
|
import type { Ref } from 'vue';
|
|
2
3
|
declare global {
|
|
3
4
|
namespace Mce {
|
|
@@ -7,10 +8,26 @@ declare global {
|
|
|
7
8
|
interface TimelineConfig {
|
|
8
9
|
visible: boolean;
|
|
9
10
|
}
|
|
11
|
+
/** 正在轨道上编辑的关键帧(点击菱形时弹出浮层),null 表示未打开。 */
|
|
12
|
+
interface KeyframeEditing {
|
|
13
|
+
anim: Animation;
|
|
14
|
+
offset: number;
|
|
15
|
+
/** 锚点屏幕坐标(菱形中心顶端),供浮层定位。 */
|
|
16
|
+
target: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** 循环模式:单次(到尾暂停)/ 循环(回到开头)/ 往返(到尾反向)。 */
|
|
22
|
+
type LoopMode = 'none' | 'loop' | 'alternate';
|
|
10
23
|
interface Editor {
|
|
11
24
|
paused: Ref<boolean>;
|
|
12
25
|
fps: Ref<number>;
|
|
26
|
+
/** 播放倍速,1 为正常速度。 */
|
|
27
|
+
playbackRate: Ref<number>;
|
|
28
|
+
loopMode: Ref<LoopMode>;
|
|
13
29
|
recomputeTimelineEndTime: () => Promise<void>;
|
|
30
|
+
keyframeEditing: Ref<KeyframeEditing | null>;
|
|
14
31
|
}
|
|
15
32
|
interface Commands {
|
|
16
33
|
play: () => void;
|
|
@@ -5,6 +5,10 @@ declare global {
|
|
|
5
5
|
}
|
|
6
6
|
interface ToolbeltConfig {
|
|
7
7
|
visible: boolean;
|
|
8
|
+
/** 浮动停靠方向:上 / 下 / 左 / 右。左右为竖向排列。默认 bottom。 */
|
|
9
|
+
placement?: 'top' | 'bottom' | 'left' | 'right';
|
|
10
|
+
/** 沿停靠边的中心坐标(上 / 下 为 x、左 / 右 为 y,相对画板像素)。undefined 表示居中。 */
|
|
11
|
+
offset?: number;
|
|
8
12
|
}
|
|
9
13
|
}
|
|
10
14
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Element2D } from 'modern-canvas';
|
|
2
|
+
import type { VariablesState, VariableType, VariableValue } from '../utils';
|
|
3
|
+
declare global {
|
|
4
|
+
namespace Mce {
|
|
5
|
+
/** 节点属性路径(如 'fill.color'、'style.opacity')→ 变量 id 的绑定,存于节点 meta.variableBindings。 */
|
|
6
|
+
type VariableBindings = Record<string, string>;
|
|
7
|
+
interface Commands {
|
|
8
|
+
createVariableCollection: (name: string, modeName?: string) => string;
|
|
9
|
+
addVariableMode: (collectionId: string, name: string) => string;
|
|
10
|
+
addVariable: (collectionId: string, variable: {
|
|
11
|
+
name: string;
|
|
12
|
+
type: VariableType;
|
|
13
|
+
value: VariableValue;
|
|
14
|
+
}) => string;
|
|
15
|
+
setVariableValue: (variableId: string, modeId: string, value: VariableValue) => void;
|
|
16
|
+
/** 切换某 collection 的当前 mode(如亮 / 暗),并把绑定重新解析到画布。 */
|
|
17
|
+
setActiveVariableMode: (collectionId: string, modeId: string) => void;
|
|
18
|
+
bindVariable: (styleKey: string, variableId: string, node?: Element2D) => void;
|
|
19
|
+
unbindVariable: (styleKey: string, node?: Element2D) => void;
|
|
20
|
+
getVariablesState: () => VariablesState;
|
|
21
|
+
/** 把所有节点上的变量绑定按当前 mode 解析并写入样式。 */
|
|
22
|
+
resolveVariables: () => void;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
declare const _default: import("..").Plugin;
|
|
27
|
+
export default _default;
|
package/dist/plugins/zoom.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ declare global {
|
|
|
22
22
|
zoomTo100: () => void;
|
|
23
23
|
zoomToFit: () => void;
|
|
24
24
|
zoomToSelection: (options?: ZoomToOptions) => void;
|
|
25
|
+
zoomToNextFrame: (options?: ZoomToOptions) => void;
|
|
26
|
+
zoomToPreviousFrame: (options?: ZoomToOptions) => void;
|
|
25
27
|
}
|
|
26
28
|
interface Hotkeys {
|
|
27
29
|
zoomIn: [event: KeyboardEvent];
|