mce 0.32.2 → 0.32.4

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.
@@ -12,6 +12,8 @@ declare global {
12
12
  sizeToFit?: boolean;
13
13
  active?: boolean;
14
14
  regenId?: boolean;
15
+ /** 添加后把新元素带入视口(已在视口内则不动)。 */
16
+ intoView?: boolean;
15
17
  }
16
18
  interface ResizeElementOptions {
17
19
  deep?: boolean;
@@ -1,6 +1,7 @@
1
1
  import type { Element2D } from 'modern-canvas';
2
2
  import type { ImagePipeline as ImagePipelineRef, PipelineImage } from 'modern-idoc';
3
3
  import type { Component, Ref } from 'vue';
4
+ import type { IconValue } from '../composables/icon';
4
5
  import type { AnimationPreset, ImagePipeline } from '../utils';
5
6
  declare global {
6
7
  namespace Mce {
@@ -36,10 +37,21 @@ declare global {
36
37
  icon?: string;
37
38
  /** 是否激活(高亮)。渲染时调用,读响应式状态即可自动更新。 */
38
39
  isActive?: () => boolean;
39
- /** 点击处理。 */
40
- handle: () => void;
40
+ /** 点击处理(分隔线项可省略)。 */
41
+ handle?: () => void;
41
42
  /** 放置在内置工具之前 / 之后(默认 after)。 */
42
43
  placement?: 'before' | 'after';
44
+ /**
45
+ * 放入工具腰带「+」新建菜单(而非作为一级按钮)。有此类项时「+」菜单用它们
46
+ * (按当前模式过滤),否则回退到内置形状菜单。供 @mce/workflow 的新增节点使用。
47
+ */
48
+ slot?: 'create';
49
+ /** slot='create' 时:限定仅某编辑模式显示(缺省则所有模式)。 */
50
+ mode?: string;
51
+ /** slot='create' 时:菜单项的快捷键提示(如 ⇧T)。 */
52
+ kbd?: string;
53
+ /** slot='create' 时:分隔线分组。 */
54
+ type?: 'divider';
43
55
  }
44
56
  interface Editor {
45
57
  /** 选择重定向链。 */
@@ -75,8 +87,8 @@ declare global {
75
87
  * 合并进 IconsSymbol 的 aliases,从而让 `$<name>` 可解析。供 @mce/table、@mce/chart
76
88
  * 等把自己的图标随插件携带,核心图标集不再硬编码它们。
77
89
  */
78
- icons: Ref<Record<string, string>>;
79
- registerIcon: (name: string, path: string) => void;
90
+ icons: Ref<Record<string, IconValue>>;
91
+ registerIcon: (name: string, path: IconValue) => void;
80
92
  /**
81
93
  * 插件注册的编辑模式(除核心 'canvas' 外,如 @mce/workflow 的 'workflow')。
82
94
  * 菜单的模式切换项据此生成;模式 UI 由插件以 overlay 组件按 mode 自行条件渲染。
@@ -90,11 +102,13 @@ declare global {
90
102
  statusbarItems: Ref<Component[]>;
91
103
  registerStatusbarItem: (component: Component) => void;
92
104
  /**
93
- * 插件向工具腰带追加的一级按钮(如 @mce/comments 的评论工具)。
105
+ * 插件向工具腰带追加的一级按钮(如 @mce/comments 的评论工具)或「+」菜单创建项。
94
106
  * Toolbelt 据此渲染,核心不再硬编码插件工具。
107
+ * `registerToolbeltItem` 返回移除函数;也可用 `unregisterToolbeltItem` 按引用移除。
95
108
  */
96
109
  toolbeltItems: Ref<ToolbeltItem[]>;
97
- registerToolbeltItem: (item: ToolbeltItem) => void;
110
+ registerToolbeltItem: (item: ToolbeltItem) => () => void;
111
+ unregisterToolbeltItem: (item: ToolbeltItem) => void;
98
112
  /**
99
113
  * 插件注册的动画预设(进入 / 退出 / 强调)。核心不内置任何预设——
100
114
  * Timeline / Trackhead 的「添加动画」菜单据此生成,为空时不显示添加入口。
@@ -5,6 +5,8 @@ declare global {
5
5
  namespace Mce {
6
6
  interface Options {
7
7
  doc?: DocumentSource;
8
+ /** 新建空白文档时的默认名字,缺省为 'Doc'。有内容 source 时以 source 自身 name 为准。 */
9
+ docName?: string;
8
10
  }
9
11
  interface InternalDocument extends Document {
10
12
  id: string;
@@ -5,10 +5,8 @@ declare global {
5
5
  }
6
6
  interface ToolbeltConfig {
7
7
  visible: boolean;
8
- /** 浮动停靠方向:上 / 下 / 左 / 右。左右为竖向排列。默认 bottom。 */
8
+ /** 停靠方向:上 / 下 / 左 / 右。左右为竖向排列。默认 bottom。 */
9
9
  placement?: 'top' | 'bottom' | 'left' | 'right';
10
- /** 沿停靠边的中心坐标(上 / 下 为 x、左 / 右 为 y,相对画板像素)。undefined 表示居中。 */
11
- offset?: number;
12
10
  }
13
11
  }
14
12
  }
@@ -4,6 +4,8 @@ declare global {
4
4
  type Ui = keyof UIConfig;
5
5
  interface PointerDownOptions {
6
6
  allowTopFrame?: boolean;
7
+ /** 跳过双击进入内容编辑(如从节点标题转发的指针,只想拖拽/选中,不进元素文字编辑)。 */
8
+ noEnter?: boolean;
7
9
  }
8
10
  interface Commands {
9
11
  getUiConfig: <T extends Ui>(name: T) => UIConfig[T];
@@ -20,7 +20,9 @@ export declare class Doc extends Node {
20
20
  protected _pendingYUpdates: Uint8Array[];
21
21
  protected _pendingYOrigin: any;
22
22
  protected _yFlushScheduled: boolean;
23
- constructor(source?: Mce.DocumentSource);
23
+ constructor(source?: Mce.DocumentSource, options?: {
24
+ name?: string;
25
+ });
24
26
  /**
25
27
  * 累积增量并安排一个 microtask 合并转发。
26
28
  * - 零丢失:同步批次内的每条增量都进入缓冲,绝不丢弃(旧 throttle 会丢中间增量导致两端发散)。
@@ -43,7 +43,6 @@ import './plugins/import'
43
43
  import './plugins/interactions'
44
44
  import './plugins/json'
45
45
  import './plugins/layers'
46
- import './plugins/madeWith'
47
46
  import './plugins/memory'
48
47
  import './plugins/menu'
49
48
  import './plugins/node'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.32.2",
4
+ "version": "0.32.4",
5
5
  "description": "A headless infinite canvas editor framework built on WebGL rendering, supports exporting to image, video, and PPT. Only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",
@@ -60,10 +60,10 @@
60
60
  "@vueuse/core": "^14.3.0",
61
61
  "diff": "^9.0.0",
62
62
  "lodash-es": "^4.18.1",
63
- "modern-canvas": "^0.25.2",
64
- "modern-font": "^0.6.1",
63
+ "modern-canvas": "^0.26.3",
64
+ "modern-font": "^0.6.2",
65
65
  "modern-idoc": "^0.12.3",
66
- "modern-text": "^2.0.9",
66
+ "modern-text": "^2.1.3",
67
67
  "y-protocols": "^1.0.7",
68
68
  "yjs": "^13.6.31"
69
69
  },
@@ -1,3 +0,0 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
- declare const _default: typeof __VLS_export;
3
- export default _default;
@@ -1,12 +0,0 @@
1
- declare global {
2
- namespace Mce {
3
- interface UIConfig {
4
- madeWith: MadeWithConfig;
5
- }
6
- interface MadeWithConfig {
7
- visible: boolean;
8
- }
9
- }
10
- }
11
- declare const _default: import("../plugin").Plugin;
12
- export default _default;