@veltdev/ace-crdt-react 1.0.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.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # Velt Ace CRDT React Library
2
+
3
+ Add real-time collaborative editing to React applications that use Ace. This package wraps `@veltdev/ace-crdt` with React lifecycle APIs for `react-ace`, Velt auth readiness, selection awareness, versions, persistence, and cleanup.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @veltdev/ace-crdt-react @veltdev/ace-crdt react-ace ace-builds @veltdev/react @veltdev/types
9
+ ```
10
+
11
+ ## Features
12
+
13
+ - `useCollaboration` hook for binding an Ace editor to a Velt CRDT text Store
14
+ - `AceCrdtEditor` drop-in component around `react-ace`
15
+ - `AceCrdtProvider` context for sharing hook state (with the `useCollaborationContext` accessor)
16
+ - Multi-user text editing with Y.Text conflict handling delegated to `@veltdev/ace-crdt`
17
+ - Remote cursors, selections, and highlight markers through Ace markers
18
+ - Undo/redo through the base Yjs UndoManager
19
+ - Version save/list/restore helpers
20
+ - Persistence, offline reconnect, and force reset support
21
+
22
+ ## Quick Start
23
+
24
+ ```tsx
25
+ import { VeltProvider } from '@veltdev/react';
26
+ import { AceCrdtEditor } from '@veltdev/ace-crdt-react';
27
+
28
+ export function App() {
29
+ return (
30
+ <VeltProvider apiKey="YOUR_API_KEY">
31
+ <AceCrdtEditor
32
+ documentId="shared-code"
33
+ initialContent="console.log('hello');"
34
+ onManagerReady={(manager) => manager.flushEditorToStore('ready')}
35
+ />
36
+ </VeltProvider>
37
+ );
38
+ }
39
+ ```
40
+
41
+ ## Hook API
42
+
43
+ Use `useCollaboration` when your application creates the Ace editor itself.
44
+
45
+ ```tsx
46
+ const collaboration = useCollaboration({
47
+ editorId: 'shared-code',
48
+ editor,
49
+ initialContent: 'const value = 1;',
50
+ });
51
+ ```
52
+
53
+ The hook returns the base manager, Ace editor, Yjs/Velt primitives, current value, connection state, remote selections, stats, versions, and delegated helpers such as `setValue`, `insertText`, `flushEditorToStore`, `forceReset`, `addHighlight`, `saveVersion`, `restoreVersion`, `undo`, and `redo`.
54
+
55
+ ## Component API
56
+
57
+ `AceCrdtEditor` accepts normal `react-ace` props plus collaboration props including `documentId`, `veltClient`, `initialContent`, `cursorData`, `rangeFactory`, `debounceMs`, `enabled`, `onEditorReady`, `onManagerReady`, and `onStatusChange`.
58
+
59
+ ## Documentation
60
+
61
+ See the package repository for the full integration guide, demo, test plan, known issues, and generation report.
62
+
63
+ ## Security
64
+
65
+ Velt is SOC 2 Type 2 and HIPAA compliant. Learn more at https://velt.dev/security.