mce 0.25.1 → 0.26.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.
Files changed (2) hide show
  1. package/README.md +6 -6
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -91,7 +91,7 @@ Specialized features also ship as optional packages, registered the same way (`p
91
91
  | --- | --- |
92
92
  | `@mce/table` | Table element + in-canvas table editor |
93
93
  | `@mce/chart` | Chart elements (bar / line / pie / …) |
94
- | `@mce/ai` | Typed AI canvas action schema (`applyAiActions`) |
94
+ | `@mce/ai` | Typed AI canvas action schema (`applyAi`) |
95
95
  | `@mce/workflow` | Node-graph editing mode |
96
96
  | `@mce/collaboration` | Real-time collaboration: transport providers + presence (cursors / selection / avatars) |
97
97
  | `@mce/comments` | Comments: comment tool + pins anchored to elements + threads (stored on `element.comments`) |
@@ -261,7 +261,7 @@ editor.exec('addAnimationKeyframe', 1, { left: 300, opacity: 1 })
261
261
  const lottie = editor.exec('exportLottie')
262
262
 
263
263
  // AI canvas actions (validated, applied in one undo step) — needs @mce/ai
264
- editor.exec('applyAiActions', [
264
+ editor.exec('applyAi', [
265
265
  { type: 'createText', text: 'Hello', x: 40, y: 40 },
266
266
  { type: 'align', direction: 'left' },
267
267
  ])
@@ -270,7 +270,7 @@ editor.exec('applyAiActions', [
270
270
  ## 🤖 AI
271
271
 
272
272
  `@mce/ai` ships a **typed action layer**, not a model. It gives you a schema to
273
- put in your prompt and a safe `applyAiActions` that validates / sanitizes a batch
273
+ put in your prompt and a safe `applyAi` that validates / sanitizes a batch
274
274
  of actions and applies them in a single undo step — wiring the LLM call is up to you.
275
275
 
276
276
  **1. Register the plugin**
@@ -285,7 +285,7 @@ new Editor({ plugins: [ai()] })
285
285
  ```ts
286
286
  const prompt = editor.exec('getAiPrompt', userInput)
287
287
  // Already includes the action schema and every existing node id (so the model can
288
- // reference current elements). Need the raw schema instead? editor.exec('getAiActionSchema').
288
+ // reference current elements). Need the raw schema instead? editor.exec('getAiSchema').
289
289
  ```
290
290
 
291
291
  **3. Call your own model, then apply the returned actions**
@@ -295,7 +295,7 @@ const prompt = editor.exec('getAiPrompt', userInput)
295
295
  const text = await callYourLLM(prompt)
296
296
  const actions = JSON.parse(text) // e.g. [{ type: 'createText', text: 'Hi', x: 40, y: 40 }]
297
297
 
298
- const { created, errors } = editor.exec('applyAiActions', actions)
298
+ const { created, errors } = editor.exec('applyAi', actions)
299
299
  // created: ids of newly created elements
300
300
  // errors: rejected actions + reasons (invalid fields / unknown node ids) — skipped, not applied
301
301
  ```
@@ -384,7 +384,7 @@ called via `editor.exec(name, …)` rather than imported.
384
384
  | Package | Description | Key exports |
385
385
  | --- | --- | --- |
386
386
  | `mce` | Headless infinite-canvas editor core (WebGL; export to image / video / PPT). | `Editor`, `EditorLayout`, `EditorLayoutItem`, `EditorLayers`, `createShapeElement` / `createTextElement` / … factories, `useEditor` |
387
- | `@mce/ai` | LLM-driven, typed canvas actions (`createText` / `createShape` / `setStyle` / `move` / `select` / `delete` / `duplicate` / `align`) applied in one undo step with automatic validation. | `plugin` (default); `validateAiActions`, `AI_ACTION_SCHEMA` (commands: `applyAiActions`, `getAiActionSchema`, `getAiPrompt`) |
387
+ | `@mce/ai` | LLM-driven, typed canvas actions (`createText` / `createShape` / `setStyle` / `move` / `select` / `delete` / `duplicate` / `align`) applied in one undo step with automatic validation. | `plugin` (default); `validateAiActions`, `AI_ACTION_SCHEMA` (commands: `applyAi`, `getAiSchema`, `getAiPrompt`) |
388
388
  | `@mce/bigesj` | Bigesj design-doc integration: font preloading, clipboard paste detection, and PPTX / XLSX / DOCX loading. | `plugin(options)` (default); `useFonts`, `bigeLoader`, `bidTidLoader`, `clipboardLoader` |
389
389
  | `@mce/chart` | Bar / line / pie chart elements with a built-in data editor and toolbelt entry. | `plugin` (default); `createChartElement(type, options)` |
390
390
  | `@mce/collaboration` | Real-time multi-user editing (Yjs CRDT) over a pluggable provider (built-in WebSocket, y-websocket compatible; swap for WebRTC / BroadcastChannel) plus presence (remote cursors / selection / avatars). | `plugin` (default, registers collaboration + presence); `collaborationPlugin`, `presencePlugin`, `AbstractProvider`, `WebsocketProvider` |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.25.1",
4
+ "version": "0.26.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",