mce 0.25.1 → 0.26.1

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 +13 -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`) |
@@ -108,6 +108,13 @@ npm i mce
108
108
  <script setup lang="ts">
109
109
  import { Editor, EditorLayout, EditorLayoutItem } from 'mce'
110
110
  import 'mce/styles'
111
+ // Plugins that ship UI components export their own stylesheet — import it or
112
+ // their editor styles (chart / table / comments / presence / workflow) are missing.
113
+ import '@mce/chart/styles'
114
+ import '@mce/collaboration/styles'
115
+ import '@mce/comments/styles'
116
+ import '@mce/table/styles'
117
+ import '@mce/workflow/styles'
111
118
  import ai from '@mce/ai'
112
119
  import chart from '@mce/chart'
113
120
  import collaboration from '@mce/collaboration'
@@ -261,7 +268,7 @@ editor.exec('addAnimationKeyframe', 1, { left: 300, opacity: 1 })
261
268
  const lottie = editor.exec('exportLottie')
262
269
 
263
270
  // AI canvas actions (validated, applied in one undo step) — needs @mce/ai
264
- editor.exec('applyAiActions', [
271
+ editor.exec('applyAi', [
265
272
  { type: 'createText', text: 'Hello', x: 40, y: 40 },
266
273
  { type: 'align', direction: 'left' },
267
274
  ])
@@ -270,7 +277,7 @@ editor.exec('applyAiActions', [
270
277
  ## 🤖 AI
271
278
 
272
279
  `@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
280
+ put in your prompt and a safe `applyAi` that validates / sanitizes a batch
274
281
  of actions and applies them in a single undo step — wiring the LLM call is up to you.
275
282
 
276
283
  **1. Register the plugin**
@@ -285,7 +292,7 @@ new Editor({ plugins: [ai()] })
285
292
  ```ts
286
293
  const prompt = editor.exec('getAiPrompt', userInput)
287
294
  // 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').
295
+ // reference current elements). Need the raw schema instead? editor.exec('getAiSchema').
289
296
  ```
290
297
 
291
298
  **3. Call your own model, then apply the returned actions**
@@ -295,7 +302,7 @@ const prompt = editor.exec('getAiPrompt', userInput)
295
302
  const text = await callYourLLM(prompt)
296
303
  const actions = JSON.parse(text) // e.g. [{ type: 'createText', text: 'Hi', x: 40, y: 40 }]
297
304
 
298
- const { created, errors } = editor.exec('applyAiActions', actions)
305
+ const { created, errors } = editor.exec('applyAi', actions)
299
306
  // created: ids of newly created elements
300
307
  // errors: rejected actions + reasons (invalid fields / unknown node ids) — skipped, not applied
301
308
  ```
@@ -384,7 +391,7 @@ called via `editor.exec(name, …)` rather than imported.
384
391
  | Package | Description | Key exports |
385
392
  | --- | --- | --- |
386
393
  | `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`) |
394
+ | `@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
395
  | `@mce/bigesj` | Bigesj design-doc integration: font preloading, clipboard paste detection, and PPTX / XLSX / DOCX loading. | `plugin(options)` (default); `useFonts`, `bigeLoader`, `bidTidLoader`, `clipboardLoader` |
389
396
  | `@mce/chart` | Bar / line / pie chart elements with a built-in data editor and toolbelt entry. | `plugin` (default); `createChartElement(type, options)` |
390
397
  | `@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.1",
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",