@coaction/yjs 1.5.0 → 2.1.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 +6 -5
- package/dist/index.d.mts +28 -22
- package/dist/index.d.ts +28 -22
- package/dist/index.js +686 -554
- package/dist/index.mjs +661 -548
- package/package.json +39 -42
package/README.md
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
# @coaction/yjs
|
|
2
2
|
|
|
3
|
-
](https://www.npmjs.com/package/@coaction/yjs)
|
|
5
|
-

|
|
3
|
+
 [](https://www.npmjs.com/package/@coaction/yjs) 
|
|
6
4
|
|
|
7
5
|
A Coaction integration tool for Yjs.
|
|
8
6
|
|
|
9
7
|
## Installation
|
|
10
8
|
|
|
11
9
|
```sh
|
|
12
|
-
|
|
10
|
+
pnpm add coaction @coaction/yjs
|
|
13
11
|
```
|
|
14
12
|
|
|
15
13
|
## Quick Start
|
|
@@ -112,6 +110,9 @@ Middleware wrapper around `bindYjs`. It also wires cleanup into `store.destroy()
|
|
|
112
110
|
- Keep the synced state plain and serializable.
|
|
113
111
|
- Methods and getters are Coaction runtime behavior and are not the synchronization payload.
|
|
114
112
|
- Prefer a plain object at the root of your store state.
|
|
113
|
+
- Remote snapshots and delete operations obey Coaction's fixed schema rules:
|
|
114
|
+
unknown root keys are rejected, while known single-store root keys may be
|
|
115
|
+
absent and then read as `undefined` from the public state object.
|
|
115
116
|
|
|
116
117
|
## Compatibility and Limits
|
|
117
118
|
|
|
@@ -138,4 +139,4 @@ Middleware wrapper around `bindYjs`. It also wires cleanup into `store.destroy()
|
|
|
138
139
|
|
|
139
140
|
## Documentation
|
|
140
141
|
|
|
141
|
-
You can find the project documentation [here](https://github.com/
|
|
142
|
+
You can find the project documentation [here](https://github.com/coactionjs/coaction).
|
package/dist/index.d.mts
CHANGED
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as Y from
|
|
3
|
-
export * from
|
|
1
|
+
import { Middleware, Store } from "coaction";
|
|
2
|
+
import * as Y from "yjs";
|
|
3
|
+
export * from "yjs";
|
|
4
4
|
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region packages/coaction-yjs/src/index.d.ts
|
|
5
8
|
type YjsBindingOptions = {
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
doc?: Y.Doc;
|
|
10
|
+
key?: string;
|
|
8
11
|
};
|
|
9
|
-
type YjsBinding<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
type YjsBinding<_T extends object> = {
|
|
13
|
+
doc: Y.Doc;
|
|
14
|
+
map: Y.Map<any>;
|
|
15
|
+
syncNow: () => void;
|
|
16
|
+
destroy: () => void;
|
|
17
|
+
__unsafeTestOnly__?: {
|
|
18
|
+
applyRemoteOperations: (operations: Array<{
|
|
19
|
+
type: 'set' | 'delete';
|
|
20
|
+
path: Array<string | number>;
|
|
21
|
+
value?: unknown;
|
|
22
|
+
}>) => void;
|
|
23
|
+
};
|
|
21
24
|
};
|
|
22
25
|
declare const __unsafeTestOnly__: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
getYValueAtPath: (root: Y.Map<unknown>, path: Array<string | number>) => unknown;
|
|
27
|
+
setAtPath: (target: any, path: Array<string | number>, value: unknown) => void;
|
|
28
|
+
deleteAtPath: (target: any, path: Array<string | number>) => void;
|
|
26
29
|
};
|
|
27
30
|
declare const bindYjs: <T extends object>(store: Store<T>, options?: YjsBindingOptions) => YjsBinding<T>;
|
|
28
31
|
declare const yjs: <T extends object>(options?: YjsBindingOptions) => Middleware<T>;
|
|
29
|
-
|
|
30
|
-
export {
|
|
32
|
+
declare namespace index_d_exports {
|
|
33
|
+
export { YjsBinding, YjsBindingOptions, __unsafeTestOnly__, bindYjs, yjs };
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { YjsBinding, YjsBindingOptions, __unsafeTestOnly__, bindYjs, yjs };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as Y from
|
|
3
|
-
export * from
|
|
1
|
+
import { Middleware, Store } from "coaction";
|
|
2
|
+
import * as Y from "yjs";
|
|
3
|
+
export * from "yjs";
|
|
4
4
|
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region packages/coaction-yjs/src/index.d.ts
|
|
5
8
|
type YjsBindingOptions = {
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
doc?: Y.Doc;
|
|
10
|
+
key?: string;
|
|
8
11
|
};
|
|
9
|
-
type YjsBinding<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
type YjsBinding<_T extends object> = {
|
|
13
|
+
doc: Y.Doc;
|
|
14
|
+
map: Y.Map<any>;
|
|
15
|
+
syncNow: () => void;
|
|
16
|
+
destroy: () => void;
|
|
17
|
+
__unsafeTestOnly__?: {
|
|
18
|
+
applyRemoteOperations: (operations: Array<{
|
|
19
|
+
type: 'set' | 'delete';
|
|
20
|
+
path: Array<string | number>;
|
|
21
|
+
value?: unknown;
|
|
22
|
+
}>) => void;
|
|
23
|
+
};
|
|
21
24
|
};
|
|
22
25
|
declare const __unsafeTestOnly__: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
getYValueAtPath: (root: Y.Map<unknown>, path: Array<string | number>) => unknown;
|
|
27
|
+
setAtPath: (target: any, path: Array<string | number>, value: unknown) => void;
|
|
28
|
+
deleteAtPath: (target: any, path: Array<string | number>) => void;
|
|
26
29
|
};
|
|
27
30
|
declare const bindYjs: <T extends object>(store: Store<T>, options?: YjsBindingOptions) => YjsBinding<T>;
|
|
28
31
|
declare const yjs: <T extends object>(options?: YjsBindingOptions) => Middleware<T>;
|
|
29
|
-
|
|
30
|
-
export {
|
|
32
|
+
declare namespace index_d_exports {
|
|
33
|
+
export { YjsBinding, YjsBindingOptions, __unsafeTestOnly__, bindYjs, yjs };
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { YjsBinding, YjsBindingOptions, __unsafeTestOnly__, bindYjs, yjs };
|