mce 0.26.1 → 0.27.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.
@@ -86,6 +86,7 @@ declare const _default: {
86
86
  collapse: string;
87
87
  removeKeyframe: string;
88
88
  custom: string;
89
+ default: string;
89
90
  saveEasingPreset: string;
90
91
  playbackRate: string;
91
92
  loopMode: string;
@@ -98,16 +99,6 @@ declare const _default: {
98
99
  animGroupIn: string;
99
100
  animGroupOut: string;
100
101
  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
102
  interactions: string;
112
103
  preview: string;
113
104
  exitPreview: string;
@@ -87,6 +87,7 @@ declare const _default: {
87
87
  collapse: string;
88
88
  removeKeyframe: string;
89
89
  custom: string;
90
+ default: string;
90
91
  saveEasingPreset: string;
91
92
  playbackRate: string;
92
93
  loopMode: string;
@@ -99,16 +100,6 @@ declare const _default: {
99
100
  animGroupIn: string;
100
101
  animGroupOut: string;
101
102
  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
103
  interactions: string;
113
104
  preview: string;
114
105
  exitPreview: string;
@@ -1,5 +1,6 @@
1
1
  import type { Element2D } from 'modern-canvas';
2
2
  import type { Component, Ref } from 'vue';
3
+ import type { AnimationPreset } from '../utils';
3
4
  declare global {
4
5
  namespace Mce {
5
6
  /**
@@ -93,6 +94,14 @@ declare global {
93
94
  */
94
95
  toolbeltItems: Ref<ToolbeltItem[]>;
95
96
  registerToolbeltItem: (item: ToolbeltItem) => void;
97
+ /**
98
+ * 插件注册的动画预设(进入 / 退出 / 强调)。核心不内置任何预设——
99
+ * Timeline / Trackhead 的「添加动画」菜单据此生成,为空时不显示添加入口。
100
+ * 注册同 id 则覆盖。预设的显示名走 i18n(`t(preset.id)`),由注册方提供文案。
101
+ */
102
+ animationPresets: Ref<AnimationPreset[]>;
103
+ registerAnimationPreset: (preset: AnimationPreset) => void;
104
+ getAnimationPreset: (id: string) => AnimationPreset | undefined;
96
105
  }
97
106
  }
98
107
  }
package/dist/plugin.d.ts CHANGED
@@ -11,7 +11,7 @@ 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)。 */
14
+ /** 停靠面板是否可拖拽调整尺寸(默认 false;尺寸跟随 size,需拖拽时显式设 true)。 */
15
15
  resizable?: boolean;
16
16
  /** 停靠面板拖拽尺寸下限 / 上限。 */
17
17
  minSize?: number;
@@ -1,8 +1,11 @@
1
1
  import type { Keyframe } from './keyframes';
2
2
  /**
3
- * 预设动画库(纯数据 / 纯函数)。每个预设按元素「当前基础样式」生成扁平关键帧
4
- * (而非写死绝对值),分为进入 / 退出 / 强调三类。利用 modern-canvas Animation 的
5
- * 两端填充特性:进入动画收尾停在基础值、退出动画收尾保持终值,无需额外 fill 配置。
3
+ * 动画预设的类型契约(核心只提供类型,不内置任何预设)。
4
+ * 预设由插件 / 宿主经 `editor.registerAnimationPreset` 注册,分进入 / 退出 / 强调三类。
5
+ *
6
+ * 约定:`build` 依据元素「当前基础样式」生成扁平关键帧(而非写死绝对值),
7
+ * 利用 modern-canvas Animation 的两端填充——进入收尾停在基础值、退出收尾保持终值,
8
+ * 无需额外 fill 配置。
6
9
  */
7
10
  export type PresetCategory = 'in' | 'out' | 'emphasis';
8
11
  export interface PresetChannels {
@@ -23,5 +26,3 @@ export interface AnimationPreset {
23
26
  /** 依据元素基础样式生成关键帧。 */
24
27
  build: (base: PresetChannels) => Keyframe[];
25
28
  }
26
- export declare const ANIMATION_PRESETS: AnimationPreset[];
27
- export declare function getPreset(id: string): AnimationPreset | undefined;
@@ -14,5 +14,6 @@ export * from './lottie';
14
14
  export * from './propsFactory';
15
15
  export * from './remapTextSelection';
16
16
  export * from './saveAs';
17
+ export * from './transform';
17
18
  export * from './traverse';
18
19
  export * from './variables';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * CSS transform 字符串的解析 / 序列化(用于关键帧编辑:WAAPI 风格的 transform 关键帧
3
+ * 拆成可编辑分量,改完再拼回字符串,存储仍是原始 transform 字符串)。纯函数,可单测。
4
+ */
5
+ export interface TransformFn {
6
+ name: string;
7
+ /** 各参数的数值与单位(如 100 + '%'、-30 + 'deg'、1 + '')。 */
8
+ args: {
9
+ value: number;
10
+ unit: string;
11
+ }[];
12
+ }
13
+ /** 解析 transform 字符串为有序函数列表;保留函数顺序与各参数单位。 */
14
+ export declare function parseTransform(input: string): TransformFn[];
15
+ /** 把函数列表拼回 transform 字符串(顺序、单位与解析时一致)。 */
16
+ export declare function serializeTransform(fns: TransformFn[]): string;
17
+ /** 单个可编辑分量:定位到某函数的某个参数,带友好标签。 */
18
+ export interface TransformField {
19
+ label: string;
20
+ value: number;
21
+ unit: string;
22
+ fnIndex: number;
23
+ argIndex: number;
24
+ }
25
+ /** 从 transform 字符串提取可编辑分量列表(仅暴露有意义的参数)。 */
26
+ export declare function transformFields(fns: TransformFn[]): TransformField[];
27
+ /** 不可变地更新某分量的数值,返回新的 transform 字符串。 */
28
+ export declare function setTransformField(fns: TransformFn[], fnIndex: number, argIndex: number, value: number): string;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.26.1",
4
+ "version": "0.27.0",
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,9 +60,9 @@
60
60
  "@vueuse/core": "^14.3.0",
61
61
  "diff": "^9.0.0",
62
62
  "lodash-es": "^4.18.1",
63
- "modern-canvas": "^0.24.1",
63
+ "modern-canvas": "^0.24.2",
64
64
  "modern-font": "^0.6.1",
65
- "modern-idoc": "^0.12.0",
65
+ "modern-idoc": "^0.12.1",
66
66
  "modern-text": "^2.0.6",
67
67
  "y-protocols": "^1.0.7",
68
68
  "yjs": "^13.6.31"