@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 CHANGED
@@ -1,15 +1,13 @@
1
1
  # @coaction/yjs
2
2
 
3
- ![Node CI](https://github.com/unadlib/coaction/workflows/Node%20CI/badge.svg)
4
- [![npm](https://img.shields.io/npm/v/@coaction/yjs.svg)](https://www.npmjs.com/package/@coaction/yjs)
5
- ![license](https://img.shields.io/npm/l/@coaction/yjs)
3
+ ![Node CI](https://github.com/coactionjs/coaction/workflows/Node%20CI/badge.svg) [![npm](https://img.shields.io/npm/v/@coaction/yjs.svg)](https://www.npmjs.com/package/@coaction/yjs) ![license](https://img.shields.io/npm/l/@coaction/yjs)
6
4
 
7
5
  A Coaction integration tool for Yjs.
8
6
 
9
7
  ## Installation
10
8
 
11
9
  ```sh
12
- npm install coaction @coaction/yjs
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/unadlib/coaction).
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 { Store, Middleware } from 'coaction';
2
- import * as Y from 'yjs';
3
- export * from 'yjs';
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
- doc?: Y.Doc;
7
- key?: string;
9
+ doc?: Y.Doc;
10
+ key?: string;
8
11
  };
9
- type YjsBinding<T extends object> = {
10
- doc: Y.Doc;
11
- map: Y.Map<any>;
12
- syncNow: () => void;
13
- destroy: () => void;
14
- __unsafeTestOnly__?: {
15
- applyRemoteOperations: (operations: Array<{
16
- type: 'set' | 'delete';
17
- path: Array<string | number>;
18
- value?: unknown;
19
- }>) => void;
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
- getYValueAtPath: (root: Y.Map<unknown>, path: Array<string | number>) => unknown;
24
- setAtPath: (target: any, path: Array<string | number>, value: unknown) => void;
25
- deleteAtPath: (target: any, path: Array<string | number>) => void;
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 { type YjsBinding, type YjsBindingOptions, __unsafeTestOnly__, bindYjs, yjs };
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 { Store, Middleware } from 'coaction';
2
- import * as Y from 'yjs';
3
- export * from 'yjs';
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
- doc?: Y.Doc;
7
- key?: string;
9
+ doc?: Y.Doc;
10
+ key?: string;
8
11
  };
9
- type YjsBinding<T extends object> = {
10
- doc: Y.Doc;
11
- map: Y.Map<any>;
12
- syncNow: () => void;
13
- destroy: () => void;
14
- __unsafeTestOnly__?: {
15
- applyRemoteOperations: (operations: Array<{
16
- type: 'set' | 'delete';
17
- path: Array<string | number>;
18
- value?: unknown;
19
- }>) => void;
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
- getYValueAtPath: (root: Y.Map<unknown>, path: Array<string | number>) => unknown;
24
- setAtPath: (target: any, path: Array<string | number>, value: unknown) => void;
25
- deleteAtPath: (target: any, path: Array<string | number>) => void;
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 { type YjsBinding, type YjsBindingOptions, __unsafeTestOnly__, bindYjs, yjs };
32
+ declare namespace index_d_exports {
33
+ export { YjsBinding, YjsBindingOptions, __unsafeTestOnly__, bindYjs, yjs };
34
+ }
35
+ //#endregion
36
+ export { YjsBinding, YjsBindingOptions, __unsafeTestOnly__, bindYjs, yjs };