@lexion-rte/extensions 0.1.1 → 0.1.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @lexion-rte/extensions
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Refresh package metadata links and expand package-level README documentation.
8
+ - Updated dependencies
9
+ - @lexion-rte/core@0.1.2
10
+
3
11
  ## 0.1.1
4
12
 
5
13
  ### Patch Changes
package/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  # @lexion-rte/extensions
2
2
 
3
- Feature extension set for Lexion.
3
+ Feature extension bundle for Lexion.
4
4
 
5
- ## What It Is
5
+ ## Overview
6
6
 
7
- `@lexion-rte/extensions` ships starter-kit commands/schema plus optional AI and collaboration extension helpers.
7
+ `@lexion-rte/extensions` ships:
8
+
9
+ - starter-kit schema and commands
10
+ - AI extension primitives (`AIService`, `aiExtension`)
11
+ - collaboration extension primitives (`createCollaborationExtension`)
8
12
 
9
13
  ## Install
10
14
 
@@ -12,19 +16,93 @@ Feature extension set for Lexion.
12
16
  pnpm add @lexion-rte/extensions @lexion-rte/core
13
17
  ```
14
18
 
15
- ## Usage
19
+ For collaboration features:
20
+
21
+ ```bash
22
+ pnpm add yjs y-protocols y-prosemirror
23
+ ```
24
+
25
+ ## Exports
26
+
27
+ - `starterKitExtension`
28
+ - `starterKitSchema`
29
+ - `createStarterKitSchema()`
30
+ - `createStarterKitCommands()`
31
+ - `starterKitCommandNames`
32
+ - `aiExtension`, `aiCommandNames`, `AIService`, `createAIService()`
33
+ - `createCollaborationExtension()`, `collaborationCommandNames`
34
+
35
+ ## Starter Kit Commands
36
+
37
+ `starterKitCommandNames` includes:
38
+
39
+ - `setParagraph`
40
+ - `toggleHeading`
41
+ - `toggleBold`
42
+ - `toggleItalic`
43
+ - `wrapBulletList`
44
+ - `wrapOrderedList`
45
+ - `liftListItem`
46
+ - `sinkListItem`
47
+ - `setLink`
48
+ - `unsetLink`
49
+ - `undo`
50
+ - `redo`
51
+
52
+ ## Starter Kit Example
53
+
54
+ ```ts
55
+ import { LexionEditor } from "@lexion-rte/core";
56
+ import { starterKitExtension, starterKitCommandNames } from "@lexion-rte/extensions";
57
+
58
+ const editor = new LexionEditor({ extensions: [starterKitExtension] });
59
+
60
+ editor.execute(starterKitCommandNames.toggleHeading, { level: 2 });
61
+ editor.execute(starterKitCommandNames.toggleBold);
62
+ editor.execute(starterKitCommandNames.setLink, {
63
+ href: "https://example.com",
64
+ title: "Example"
65
+ });
66
+ ```
67
+
68
+ ## AI Service Example
69
+
70
+ ```ts
71
+ import { LexionEditor } from "@lexion-rte/core";
72
+ import { AIService, aiExtension, starterKitExtension } from "@lexion-rte/extensions";
73
+
74
+ const editor = new LexionEditor({
75
+ extensions: [starterKitExtension, aiExtension]
76
+ });
77
+
78
+ const service = new AIService({
79
+ async generate({ prompt, selection }) {
80
+ return `Prompt: ${prompt}\nSelection: ${selection}`;
81
+ }
82
+ });
83
+
84
+ await service.generateAndApply(editor, "Rewrite this paragraph clearly");
85
+ ```
86
+
87
+ ## Collaboration Example
16
88
 
17
89
  ```ts
18
90
  import { LexionEditor } from "@lexion-rte/core";
19
91
  import {
20
- starterKitExtension,
21
- starterKitCommandNames
92
+ createCollaborationExtension,
93
+ collaborationCommandNames,
94
+ starterKitExtension
22
95
  } from "@lexion-rte/extensions";
96
+ import * as Y from "yjs";
97
+ import { Awareness } from "y-protocols/awareness";
98
+
99
+ const ydoc = new Y.Doc();
100
+ const awareness = new Awareness(ydoc);
101
+ const fragment = ydoc.getXmlFragment("lexion");
23
102
 
24
103
  const editor = new LexionEditor({
25
- extensions: [starterKitExtension]
104
+ extensions: [starterKitExtension, createCollaborationExtension({ fragment, awareness })]
26
105
  });
27
106
 
28
- editor.execute(starterKitCommandNames.toggleHeading, { level: 2 });
107
+ editor.execute(collaborationCommandNames.undo);
29
108
  ```
30
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lexion-rte/extensions",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Feature extensions for the Lexion editor platform.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -43,7 +43,7 @@
43
43
  "y-prosemirror": "^1.2.12",
44
44
  "y-protocols": "^1.0.6",
45
45
  "yjs": "^13.6.23",
46
- "@lexion-rte/core": "0.1.1"
46
+ "@lexion-rte/core": "0.1.2"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsc -p tsconfig.json",