mce 0.29.9 → 0.30.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.
@@ -1,7 +1,7 @@
1
1
  import type { Element2D } from 'modern-canvas';
2
- import type { ImagePipeline, PipelineImage } from 'modern-idoc';
2
+ import type { ImagePipeline as ImagePipelineRef, PipelineImage } from 'modern-idoc';
3
3
  import type { Component, Ref } from 'vue';
4
- import type { AnimationPreset, Pipeline } from '../utils';
4
+ import type { AnimationPreset, ImagePipeline } from '../utils';
5
5
  declare global {
6
6
  namespace Mce {
7
7
  /**
@@ -105,14 +105,14 @@ declare global {
105
105
  getAnimationPreset: (id: string) => AnimationPreset | undefined;
106
106
  /**
107
107
  * 插件 / 宿主注册的图片处理管线(`image → image`,如描边/调色/抠图)。
108
- * 数据只记录管线名与参数(`ImageFill.pipelines`),处理函数为运行时黑盒。
109
- * 注册同 name 则覆盖。渲染端经引擎解析器烘焙,导出端经 `materializePipelines` 物化。
108
+ * 数据只记录管线名与参数(`ImageFill.imagePipelines`),处理函数为运行时黑盒。
109
+ * 注册同 name 则覆盖。渲染端经引擎解析器烘焙,非渲染导出端经 `materializeImagePipelines` 物化。
110
110
  */
111
- pipelines: Ref<Pipeline[]>;
112
- registerPipeline: (pipeline: Pipeline) => void;
113
- getPipeline: (name: string) => Pipeline | undefined;
111
+ imagePipelines: Ref<ImagePipeline[]>;
112
+ registerImagePipeline: (pipeline: ImagePipeline) => void;
113
+ getImagePipeline: (name: string) => ImagePipeline | undefined;
114
114
  /** 把一串管线步骤依次作用到图片像素上(引擎解析器与导出物化共用)。 */
115
- resolvePipelines: (steps: ImagePipeline[], image: PipelineImage) => Promise<PipelineImage>;
115
+ resolveImagePipelines: (steps: ImagePipelineRef[], image: PipelineImage) => Promise<PipelineImage>;
116
116
  }
117
117
  }
118
118
  }
@@ -1,26 +1,26 @@
1
- import type { ImagePipeline, PipelineImage } from 'modern-idoc';
1
+ import type { ImagePipeline as ImagePipelineRef, PipelineImage } from 'modern-idoc';
2
2
  /**
3
3
  * 图片处理管线(外部可注册):把图片像素处理成新的图片像素(`image → image`)。
4
4
  *
5
- * 数据只记录管线名与参数(`ImageFill.pipelines`),处理函数为运行时注册的黑盒,
6
- * 不入持久化数据。渲染端经引擎注入的解析器烘焙到运行时纹理;不过引擎的导出端
7
- * pdf/svg/pptx)经 `materializePipelines` 物化成成品图。
5
+ * 数据只记录管线名与参数(`ImageFill.imagePipelines`,元素类型 `ImagePipelineRef`),
6
+ * 处理函数为运行时注册的黑盒,不入持久化数据。渲染端经引擎注入的解析器烘焙到运行时纹理;
7
+ * 非渲染的导出端(pdf/svg/pptx)经 `materializeImagePipelines` 物化成成品图。
8
8
  */
9
- export interface Pipeline {
10
- /** 唯一名,对应数据 `pipelines[].name`。 */
9
+ export interface ImagePipeline {
10
+ /** 唯一名,对应数据 `imagePipelines[].name`。 */
11
11
  name: string;
12
12
  /** 显示名 i18n key(可选),供 UI 列表使用。 */
13
13
  label?: string;
14
14
  /** 处理函数:接收图片像素 + 参数,返回处理后的像素,可异步。 */
15
15
  process: (image: PipelineImage, params?: Record<string, any>) => PipelineImage | Promise<PipelineImage>;
16
16
  }
17
- type PipelineResolver = (steps: ImagePipeline[], image: PipelineImage) => Promise<PipelineImage>;
17
+ type ImagePipelineResolver = (steps: ImagePipelineRef[], image: PipelineImage) => Promise<PipelineImage>;
18
18
  /**
19
- * 导出前物化:深度遍历文档,把所有带 `pipelines` 的图片填充跑一遍管线,
20
- * 结果写回 `image`(PNG dataURI)并删除 `pipelines` 字段。这样数据解析类导出器
19
+ * 导出前物化:深度遍历文档,把所有带 `imagePipelines` 的图片填充跑一遍管线,
20
+ * 结果写回 `image`(PNG dataURI)并删除 `imagePipelines` 字段。这样数据解析类导出器
21
21
  * (pdf/svg/pptx)只看到普通图片填充,无需各自实现管线逻辑,跨端一致。
22
22
  *
23
23
  * 注意:原地修改传入的 `doc`(导出链路里 `doc` 已是 `toJSON` 出的独立快照)。
24
24
  */
25
- export declare function materializePipelines(doc: any, resolve: PipelineResolver): Promise<void>;
25
+ export declare function materializeImagePipelines(doc: any, resolve: ImagePipelineResolver): Promise<void>;
26
26
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.29.9",
4
+ "version": "0.30.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.13",
63
+ "modern-canvas": "^0.25.0",
64
64
  "modern-font": "^0.6.1",
65
- "modern-idoc": "^0.12.2",
65
+ "modern-idoc": "^0.12.3",
66
66
  "modern-text": "^2.0.9",
67
67
  "y-protocols": "^1.0.7",
68
68
  "yjs": "^13.6.31"