rhine-var 0.3.2 → 0.4.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.
Files changed (36) hide show
  1. package/README.md +149 -139
  2. package/README_zh.md +14 -8
  3. package/dist/core/class/array/RhineVarArray.d.ts +2 -2
  4. package/dist/core/class/array/RhineVarArray.d.ts.map +1 -1
  5. package/dist/core/event/Callback.d.ts +4 -1
  6. package/dist/core/event/Callback.d.ts.map +1 -1
  7. package/dist/core/event/ChangeType.d.ts +3 -3
  8. package/dist/core/event/ChangeType.d.ts.map +1 -1
  9. package/dist/core/native/Native.d.ts +2 -0
  10. package/dist/core/native/Native.d.ts.map +1 -1
  11. package/dist/core/proxy/ProxiedRhineVar.d.ts +7 -1
  12. package/dist/core/proxy/ProxiedRhineVar.d.ts.map +1 -1
  13. package/dist/core/proxy/ProxiedRhineVarItem.d.ts +7 -0
  14. package/dist/core/proxy/ProxiedRhineVarItem.d.ts.map +1 -0
  15. package/dist/core/proxy/ProxiedRhineVarItem.js +2 -0
  16. package/dist/core/proxy/Proxy.d.ts +5 -3
  17. package/dist/core/proxy/Proxy.d.ts.map +1 -1
  18. package/dist/core/proxy/Proxy.js +50 -19
  19. package/dist/core/proxy/RhineVar.d.ts +4 -26
  20. package/dist/core/proxy/RhineVar.d.ts.map +1 -1
  21. package/dist/core/proxy/RhineVar.js +11 -116
  22. package/dist/core/proxy/RhineVarItem.d.ts +38 -0
  23. package/dist/core/proxy/RhineVarItem.d.ts.map +1 -0
  24. package/dist/core/proxy/RhineVarItem.js +259 -0
  25. package/dist/core/proxy/RhineVarRoot.d.ts +8 -0
  26. package/dist/core/proxy/RhineVarRoot.d.ts.map +1 -0
  27. package/dist/core/proxy/RhineVarRoot.js +19 -0
  28. package/dist/core/utils/ConvertProperty.d.ts +2 -2
  29. package/dist/core/utils/ConvertProperty.d.ts.map +1 -1
  30. package/dist/core/utils/DataUtils.d.ts +4 -4
  31. package/dist/core/utils/DataUtils.d.ts.map +1 -1
  32. package/dist/core/utils/DataUtils.js +9 -6
  33. package/dist/index.d.ts +5 -4
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +4 -4
  36. package/package.json +1 -1
package/README.md CHANGED
@@ -1,139 +1,149 @@
1
- <div align="center">
2
-
3
- # RHINE-VAR: Simplest and Most Powerful Collaborative Framework
4
-
5
- Rhine Variable — A self-synchronizing variable for collaboration.
6
- Developing collaborative applications has never been this easy.
7
-
8
-
9
- [English](README.md) &nbsp; | &nbsp; [中文](README_zh.md)
10
-
11
- <img src='./assets/images/example1.png' style="border-radius: 10px; max-width: 840px"/>
12
-
13
- </div>
14
-
15
- <br/>
16
-
17
- ## Why Choose RHINE-VAR ?
18
-
19
- ### Concise and Efficient Syntax Design
20
- RhineVar draws inspiration from the design philosophy of the Valtio state management library, significantly reducing the learning curve. Developers can easily manage collaborative data as if they were manipulating regular variables.
21
-
22
- ### Comprehensive Type Support
23
- RhineVar offers full type hints and checks, ensuring precise code completion and static analysis during development. This not only improves the development experience but also reduces potential errors, making it especially suitable for TypeScript projects, enhancing code safety and reliability.
24
-
25
- ### Distributed Real-time Collaboration Algorithm
26
- The underlying collaboration algorithm of RhineVar is powered by the robust Yjs library. Using the CRDT (Conflict-free Replicated Data Type) algorithm, it ensures eventual consistency even in multi-user and offline environments.
27
-
28
- ### High Performance with Low Bandwidth Requirements
29
- The data synchronization and conflict resolution mechanism is highly efficient. Leveraging Yjs's incremental update mechanism, only necessary data changes are transmitted rather than the entire document, making it ideal for bandwidth-constrained environments and reducing unnecessary data transfers.
30
-
31
- ### Strong Offline Support
32
- Users can continue to work even while offline. Once reconnected, all changes are automatically synchronized, ensuring no data is lost or conflicted. This is crucial for building offline-first applications.
33
-
34
- ### Cross-platform and Framework Agnostic
35
- RhineVar can be used in various environments, including browsers, Node.js, and other JavaScript platforms. It integrates with multiple frontend frameworks and libraries such as Next.js, React, Vue.js, ProseMirror, and more.
36
-
37
- ### Lightweight and Extensible
38
- RhineVar is a highly lightweight library, with its core package only a few KB in size, making it suitable for various frontend applications. Its modular architecture supports feature extensions, allowing developers to import or develop custom modules as needed.
39
-
40
- ### Decentralized Architecture
41
- With a decentralized architecture, collaborative editing becomes more scalable, efficient, and fault-tolerant. Peer-to-peer data transfer is supported without relying on a central server (currently under development).
42
-
43
- ### Native Yjs Support
44
- RhineVar offers full support for native Yjs object operations, providing lower-level, richer API support. Direct operations on Yjs objects automatically trigger updates in RhineVar.
45
-
46
- ### More Friendly and Complete Event System
47
- RhineVar offers an extensive event subscription and listening system with intuitive data change events. It also supports deep data change monitoring within objects, catering to a wide range of use cases.
48
-
49
- <br/>
50
-
51
- ## Contact Us
52
- Welcome to join our WeChat group for communication. We look forward to having more community members participate in the creation of rhine-var.
53
-
54
- WeChat: [FNA-04]()
55
-
56
- Email: [RhineAILab@gmail.com](rhineailab@gmail.com) & [RhineAI@163.com](RhineAI@163.com)
57
-
58
- <br/>
59
-
60
- ## Install
61
- ```bash
62
- yarn add rhine-var
63
- ```
64
- If you don't have `yarn`, you can install it via `npm i rhine-var`, or install `yarn` first using `npm i -g yarn` and then use the command above to install.
65
-
66
- <br/>
67
-
68
- ## Usage
69
-
70
- ```typescript jsx
71
- const defaultValue = {value: 0}
72
- const count = rhineProxy(defaultValue, 'localhost:6600/room-0')
73
-
74
- function Counter() {
75
-
76
- const countSnap = useRhine(count)
77
-
78
- return <div>
79
- <button onClick={() => count.value-- }> - 1 </button>
80
- <span>{countSnap.value}</span>
81
- <button onClick={() => count.value++ }> + 1 </button>
82
- </div>
83
- }
84
- ```
85
- ### Default Value
86
-
87
- When the room does not exist on the server, a default value will be used to create the room. If not connected to the server, data from the default value will also be returned.
88
-
89
- ### Room ID
90
-
91
- The `Same Room ID` manages the `Same State Variables`, and users who join will experience real-time multi-user collaboration.
92
-
93
- ### rhineProxy
94
-
95
- Create a `RhineVariable` that anyone in the room can directly modify, and the value will be synchronized to everyone almost simultaneously.
96
-
97
- Its value is `at least an object` in javascript, `but` there is almost no upper limit. It can be an `extremely complex and large JSON structure` to accommodate all the data for a large project.
98
-
99
- ### useRhine
100
-
101
- A hook for use with React. It creates a snapshot of a `RhineVariable`, and whenever someone modifies this value, the information will be `updated on everyone's screen` in real-time.
102
-
103
- Use snapshot only when data needs to be displayed on the React page. For other operations, such as modifying values, please use RhineVariable itself.
104
-
105
- <br/>
106
-
107
- ## Server
108
- We provide a simple server as a reference, located at `/test/server` in this project. The server is fully compatible with all Yjs websocket servers.
109
- ```
110
- git clone https://github.com/RhineAI-Lab/rhine-var.git
111
- cd test/server
112
- yarn install
113
- yarn start
114
- ```
115
- It will run on `Port 6600`, and you can connect to it via `ws://localhost:6600/<room-id>`. `<room-id>` can be any text, with each room ID corresponding to a `RhineVariable`.
116
-
117
- More information about server develop: [https://docs.yjs.dev/ecosystem/connection-provider/y-websocket](https://docs.yjs.dev/ecosystem/connection-provider/y-websocket)
118
-
119
- <br/>
120
-
121
- ## Develop
122
-
123
- ```bash
124
- # start watch and build by typescript
125
- yarn run watch
126
-
127
- # start a easy websocket server
128
- cd test/server
129
- yarn install
130
- yarn start
131
-
132
- # start a nextjs playground for develop debug
133
- cd test/debug/next-app
134
- yarn install
135
- yarn start
136
- # Open http://localhost:3000 in browser
137
- ```
138
-
139
- <br/>
1
+ <div align="center">
2
+
3
+ # RHINE-VAR: Simplest and Powerful CRDT Library
4
+
5
+ Rhine Variable — A self-synchronizing variable for collaboration.
6
+ Developing collaborative applications has never been this easy.
7
+
8
+
9
+ [English](README.md) &nbsp; | &nbsp; [中文](README_zh.md)
10
+
11
+ <img src='./assets/images/example1.png' style="border-radius: 10px"/>
12
+
13
+ </div>
14
+
15
+ <br/>
16
+
17
+ <br/>
18
+
19
+ ## Why Choose RHINE-VAR ?
20
+
21
+ ### Concise and Efficient Syntax Design
22
+ RhineVar draws inspiration from the design philosophy of the Valtio state management library, `significantly reducing the learning curve`. Allowing developers to handle data seamlessly, as if `working with standard variables`.
23
+
24
+ ### Almost No Size Limit
25
+ There is almost no upper limit. It can be an `Extremely Complex and Large Data Structure` to accommodate all the data for a large project. But at the very least, it is `a JavaScript Object`.
26
+
27
+ ### Comprehensive Type Support
28
+ RhineVar offers full type hints and checks, ensuring `Precise Code Completion` and `Static Analysis` during development. This not only improves the development experience but also reduces potential errors, making it especially `suitable for TypeScript projects`, enhancing code safety and reliability.
29
+
30
+ ### Distributed Real-time Collaboration Algorithm
31
+ The underlying collaboration algorithm of RhineVar is `Powered By the Robust Yjs Library`. Using the CRDT (Conflict-free Replicated Data Type) algorithm, it ensures eventual consistency even in multi-user and offline environments.
32
+
33
+ ### High Performance with Low Bandwidth Requirements
34
+ The data synchronization and conflict resolution mechanism is highly efficient. Leveraging Yjs's `Incremental Update Mechanism`, only necessary data changes are transmitted rather than the entire document, making it ideal for bandwidth-constrained environments and reducing unnecessary data transfers.
35
+
36
+ ### Strong Offline Support
37
+ Users can continue to work even while offline. Once reconnected, all changes are automatically synchronized, ensuring `no data is lost or conflicted`. This is crucial for building offline-first applications.
38
+
39
+ ### Cross-platform and Framework Agnostic
40
+ RhineVar can be used in `All JavaScript Environments`, including browsers, Node.js, and other JavaScript platforms. It integrates with multiple frontend frameworks and libraries such as Next.js, React, Vue.js, ProseMirror, and more.
41
+
42
+ ### Lightweight and Extensible
43
+ RhineVar is a highly lightweight library, with its core package `only a few KB` in size, making it suitable for various frontend applications. Its modular architecture supports feature extensions, allowing developers to import or develop custom modules as needed.
44
+
45
+ ### Decentralized Architecture
46
+ With a decentralized architecture, collaborative editing becomes more scalable, efficient, and fault-tolerant. Peer-to-peer data transfer is supported without relying on a central server (currently under development).
47
+
48
+ ### Native Yjs Support
49
+ RhineVar offers full support for native Yjs object operations, providing lower-level, richer API support. `Direct operations on Yjs objects automatically trigger updates in RhineVar`.
50
+
51
+ ### More Friendly and Complete Event System
52
+ RhineVar offers an extensive event subscription and listening system with `Intuitive Data Change Events`. It also supports deep data change monitoring within objects, catering to a wide range of use cases.
53
+
54
+ ### Fully Open Source
55
+ This is a fully open-source project, licensed under the `Apache-2.0 license` on GitHub. You are `Free to use it for both Commercial and Non-commercial Projects`, and it allows modification and distribution, as long as the original copyright notice is retained.
56
+
57
+ <br/>
58
+
59
+ ## Contact Us
60
+ Welcome to join our WeChat group for communication. We look forward to having more community members participate in the creation of rhine-var.
61
+
62
+ WeChat: [FNA-04]()
63
+
64
+ Email: [RhineAILab@gmail.com](rhineailab@gmail.com) & [RhineAI@163.com](RhineAI@163.com)
65
+
66
+ <br/>
67
+
68
+ ## Install
69
+ ```bash
70
+ yarn add rhine-var
71
+ ```
72
+ If you don't have `yarn`, you can install it via `npm i rhine-var`, or install `yarn` first using `npm i -g yarn` and then use the command above to install.
73
+
74
+ <br/>
75
+
76
+ ## Usage
77
+
78
+ ```typescript jsx
79
+ const defaultValue = {value: 0}
80
+ const count = rhineProxy(defaultValue, 'localhost:6600/room-0')
81
+
82
+ function Counter() {
83
+
84
+ const countSnap = useRhine(count)
85
+
86
+ return <div>
87
+ <button onClick={() => count.value-- }> - 1 </button>
88
+ <span>{countSnap.value}</span>
89
+ <button onClick={() => count.value++ }> + 1 </button>
90
+ </div>
91
+ }
92
+ ```
93
+ ### Default Value
94
+
95
+ When the room does not exist on the server, a default value will be used to create the room. If not connected to the server, data from the default value will also be returned.
96
+
97
+ ### Room ID
98
+
99
+ &lt;room-id&gt; can be any text, with each Room ID corresponding to a RhineVariable, and users who join with the same Room ID will experience real-time multi-user collaboration.
100
+
101
+ Regarding the server-side, it will be mentioned below.
102
+
103
+ ### rhineProxy
104
+
105
+ Create a `RhineVariable` that anyone in the room can directly modify, and the value will be synchronized to everyone real-time.
106
+
107
+ Its data structure `can be quite complex`, but `at least`, it is `an object` in JavaScript.
108
+
109
+ ### useRhine
110
+
111
+ A hook for use with React. It creates a snapshot of a `RhineVariable`, and whenever someone modifies this value, the information will be `updated on everyone's screen` in real-time.
112
+
113
+ Use snapshot only when data needs to be displayed on the React page. For other operations, such as modifying values, please use RhineVariable itself.
114
+
115
+ <br/>
116
+
117
+ ## Server
118
+ We provide a simple server as a reference, located at `/test/server` in this project. The server is fully compatible with all Yjs websocket servers.
119
+ ```
120
+ git clone https://github.com/RhineAI-Lab/rhine-var.git
121
+ cd test/server
122
+ yarn install
123
+ yarn start
124
+ ```
125
+ It will run on `Port 6600`, and you can connect to it via `ws://localhost:6600/<room-id>`. `<room-id>` can be any text, with each room ID corresponding to a `RhineVariable`.
126
+
127
+ More information about server develop: [https://docs.yjs.dev/ecosystem/connection-provider/y-websocket](https://docs.yjs.dev/ecosystem/connection-provider/y-websocket)
128
+
129
+ <br/>
130
+
131
+ ## Develop
132
+
133
+ ```bash
134
+ # start watch and build by typescript
135
+ yarn run watch
136
+
137
+ # start a easy websocket server
138
+ cd test/server
139
+ yarn install
140
+ yarn start
141
+
142
+ # start a nextjs playground for develop debug
143
+ cd test/debug/next-app
144
+ yarn install
145
+ yarn start
146
+ # Open http://localhost:3000 in browser
147
+ ```
148
+
149
+ <br/>
package/README_zh.md CHANGED
@@ -16,6 +16,8 @@
16
16
 
17
17
  **简洁高效的语法设计:** &nbsp; RhineVar 借鉴了 Valtio 状态管理库的设计理念,极大地降低了学习成本。开发者可以像操作普通变量一样轻松操控协同数据。
18
18
 
19
+ **几乎没有体积上限:** &nbsp; 它几乎没有体积限制,可以是一个极其复杂且庞大的数据结构,以容纳一个大型项目所需的所有数据。但至少是一个 JavaScript 对象。
20
+
19
21
  **完备的类型支持:** &nbsp; RhineVar 提供全面的类型提示和类型检查,确保在开发过程中能够获得精确的代码补全和静态分析。这不仅改善了开发体验,还有效降低了潜在的错误风险,特别适用于 TypeScript 项目,提升了代码的安全性和可靠性。
20
22
 
21
23
  **分布式实时协作算法:** &nbsp; RhineVar 的底层协同算法基于强大的 Yjs 库。通过 CRDT (Conflict-free Replicated Data Type,无冲突复制数据类型) 算法,确保多用户同时使用,甚至离线下使用的最终一致性。
@@ -24,7 +26,7 @@
24
26
 
25
27
  **强大的离线支持:** &nbsp; 即使在离线状态下,用户仍然可以继续使用应用。当重新联机时,所有更改将自动同步,确保数据不会出现丢失或冲突。这对于构建离线优先的应用至关重要。
26
28
 
27
- **跨平台和框架无关:** &nbsp; RhineVar 支持在多种环境中使用,包括浏览器、Node.js 和其他 JavaScript 环境。此外,它可以与多个前端框架和库 (如 NextJs、React、Vue.js、ProseMirror 等) 集成。
29
+ **跨平台和框架无关:** &nbsp; RhineVar 支持在多种环境中使用,包括浏览器、Node.js 和其它 JavaScript 环境。此外,它可以与多个前端框架和库 (如 NextJs、React、Vue.js、ProseMirror 等) 集成。
28
30
 
29
31
  **轻量级且可扩展:** &nbsp; RhineVar 是一个非常轻量的库,核心包仅几 KB,适合各种前端应用。其模块化架构也支持扩展特性,开发者可以根据需要引入或开发自定义模块。
30
32
 
@@ -34,11 +36,13 @@
34
36
 
35
37
  **更友好且完善的事件体系:** &nbsp; RhineVar 提供了丰富的事件订阅监听方式,直观的数据变更事件,更好的支持数据变更的监听和处理。以及提供了对内部深层数据变化的监听,以适用更多场景。
36
38
 
39
+ **完全开源:** &nbsp; 这是个完全开源的项目,本库在 Github 上以 Apache-2.0 许可证发布。您可以自由将其用于商业和非商业项目,并且允许对其进行修改和分发,只需要保留原作者的版权声明。
40
+
37
41
  <br/>
38
42
 
39
43
  ## Contact Us
40
44
 
41
- 欢迎加入我们的微信群一起讨论交流,我们期待更多的社区成员能加入到 RHINE-VAR 的创造中来!
45
+ 欢迎加入我们的微信群一起讨论交流,我们期待更多的社区开发者能加入到 RHINE-VAR 的创造中!
42
46
 
43
47
  微信: [FNA-04]() (请备注来源)
44
48
 
@@ -79,19 +83,21 @@ function Counter() {
79
83
 
80
84
  一个房间号对应一个状态变量, 加入到一个房间中的用户会参与到多人协同中。
81
85
 
86
+ 关于服务端,下方将会提及。
87
+
82
88
  ### rhineProxy
83
89
 
84
- 用于创建一个 `RhineVariable` 他的值会和房间中的其他人共享并同步。
90
+ 用于创建一个 `RhineVariable` 它的值会和房间中的其他人共享并同步。
85
91
 
86
- 你可以像操作 JavaScript 中的普通变量一样直接随意操作他。
92
+ 你可以像操作 JavaScript 中的普通变量一样直接随意操作它。
87
93
 
88
- 值的类型至少是 JavaScript 中的 object,但没有上限。它可以是一个非常复杂和庞大的 JSON 结构,以容纳大型项目的所有数据。
94
+ 它内部的数据结构可以很复杂,但至少是 JavaScript 中的一个 object
89
95
 
90
96
  ### useRhine
91
97
 
92
- 一个 `React` 的 `Hook` 函数. 他将为 `RhineVariable` 创建一个快照, 用于自动热重载更新页面。当任何人对值做出修改时,他会把最新的值立刻更新到所有人的屏幕上。
98
+ 一个 `React` 的 `Hook` 函数. 它将为 `RhineVariable` 创建一个快照, 用于自动热重载更新页面。当任何人对值做出修改时,它会把最新的值立刻更新到所有人的屏幕上。
93
99
 
94
- 只有页面需要数据的时候使用 `useRhine` 创造的快照。在其他操作,例如赋值时,请操作原来的 `RhineVariable`。
100
+ 只有页面需要数据的时候使用 `useRhine` 创造的快照。在其它操作,例如赋值时,请操作原来的 `RhineVariable`。
95
101
 
96
102
  <br/>
97
103
 
@@ -103,7 +109,7 @@ cd test/server
103
109
  yarn install
104
110
  yarn start
105
111
  ```
106
- 默认运行在 `端口 6600`, 你可以通过连接 `ws://localhost:6600/<room-id>` 连接他,`<room-id>` 可以是任意文本,一个房间号对应一个 `RhineVariable`。
112
+ 默认运行在 `端口 6600`, 你可以通过连接 `ws://localhost:6600/<room-id>` 连接它,`<room-id>` 可以是任意文本,一个房间号对应一个 `RhineVariable`。
107
113
 
108
114
  更多服务端开发信息请参考: [https://docs.yjs.dev/ecosystem/connection-provider/y-websocket](https://docs.yjs.dev/ecosystem/connection-provider/y-websocket)
109
115
 
@@ -1,4 +1,4 @@
1
- import RhineVar from "../../proxy/RhineVar";
2
- export default class RhineVarArray<T> extends Array<T | RhineVar<T[]>> {
1
+ import RhineVarItem from "../../proxy/RhineVarItem";
2
+ export default class RhineVarArray<T> extends Array<T | RhineVarItem<T[]>> {
3
3
  }
4
4
  //# sourceMappingURL=RhineVarArray.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RhineVarArray.d.ts","sourceRoot":"","sources":["../../../../src/core/class/array/RhineVarArray.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,6BAA8B;AAE7C,MAAM,CAAC,OAAO,OAAO,aAAa,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;CAErE"}
1
+ {"version":3,"file":"RhineVarArray.d.ts","sourceRoot":"","sources":["../../../../src/core/class/array/RhineVarArray.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,iCAAkC;AAErD,MAAM,CAAC,OAAO,OAAO,aAAa,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;CAEzE"}
@@ -1,4 +1,7 @@
1
1
  import { ChangeType } from "./ChangeType";
2
2
  import { Transaction, YArrayEvent, YMapEvent } from "yjs";
3
- export type Callback<T> = (value: T[keyof T], key: keyof T, oldValue: T[keyof T], type: ChangeType, nativeEvent: YMapEvent<any> | YArrayEvent<any>, nativeTransaction: Transaction) => void;
3
+ import { YPath } from "../native/Native";
4
+ import { ProxiedRhineVarItem } from "../proxy/ProxiedRhineVar";
5
+ export type Callback<T> = (key: keyof T, value: T[keyof T] | ProxiedRhineVarItem<T[keyof T]>, oldValue: T[keyof T], type: ChangeType, nativeEvent: YMapEvent<any> | YArrayEvent<any>, nativeTransaction: Transaction) => void;
6
+ export type DeepCallback<T> = (path: YPath, value: any | ProxiedRhineVarItem<any>, oldValue: any, type: ChangeType, nativeEvent: YMapEvent<any> | YArrayEvent<any>, nativeTransaction: Transaction) => void;
4
7
  //# sourceMappingURL=Callback.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Callback.d.ts","sourceRoot":"","sources":["../../../src/core/event/Callback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,qBAAgC;AACnD,OAAO,EAAC,WAAW,EAAE,WAAW,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C,EAC9C,iBAAiB,EAAE,WAAW,KAC3B,IAAI,CAAA"}
@@ -1,7 +1,7 @@
1
1
  export declare enum ChangeType {
2
- Add = "add",
3
- Update = "update",
4
- Delete = "delete",
2
+ Add = "add",// For YMap / YArray
3
+ Update = "update",// For YMap
4
+ Delete = "delete",// For YMap / YArray
5
5
  Sync = "sync"
6
6
  }
7
7
  //# sourceMappingURL=ChangeType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChangeType.d.ts","sourceRoot":"","sources":["../../../src/core/event/ChangeType.ts"],"names":[],"mappings":"AACA,oBAAY,UAAU;IACpB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd"}
1
+ {"version":3,"file":"ChangeType.d.ts","sourceRoot":"","sources":["../../../src/core/event/ChangeType.ts"],"names":[],"mappings":"AACA,oBAAY,UAAU;IACpB,GAAG,QAAQ,CAAG,oBAAoB;IAClC,MAAM,WAAW,CAAG,WAAW;IAC/B,MAAM,WAAW,CAAG,oBAAoB;IACxC,IAAI,SAAS;CACd"}
@@ -1,3 +1,5 @@
1
1
  import { Array as YArray, Map as YMap } from "yjs";
2
2
  export type Native = YMap<any> | YArray<any>;
3
+ export type YKey = string | number;
4
+ export type YPath = YKey[];
3
5
  //# sourceMappingURL=Native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Native.d.ts","sourceRoot":"","sources":["../../../src/core/native/Native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,IAAI,MAAM,EAAE,GAAG,IAAI,IAAI,EAAC,MAAM,KAAK,CAAC;AAEjD,MAAM,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA"}
1
+ {"version":3,"file":"Native.d.ts","sourceRoot":"","sources":["../../../src/core/native/Native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,IAAI,MAAM,EAAE,GAAG,IAAI,IAAI,EAAC,MAAM,KAAK,CAAC;AAEjD,MAAM,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;AAE5C,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;AAElC,MAAM,MAAM,KAAK,GAAG,IAAI,EAAE,CAAA"}
@@ -1,6 +1,12 @@
1
+ import RhineVarItem from "./RhineVarItem";
1
2
  import RhineVar from "./RhineVar";
3
+ export type RecursiveCrossRhineVarItem<T> = {
4
+ [K in keyof T]: T[K] extends object ? RecursiveCrossRhineVarItem<T[K]> & RhineVarItem<T[K]> : T[K];
5
+ };
6
+ export type StoredRhineVarItem<T> = T & RecursiveCrossRhineVarItem<T> & RhineVarItem<T>;
7
+ export type ProxiedRhineVarItem<T> = StoredRhineVarItem<T>;
2
8
  export type RecursiveCrossRhineVar<T> = {
3
- [K in keyof T]: T[K] extends object ? RecursiveCrossRhineVar<T[K]> & RhineVar<T[K]> : T[K];
9
+ [K in keyof T]: T[K] extends object ? RecursiveCrossRhineVarItem<T[K]> & RhineVarItem<T[K]> : T[K];
4
10
  };
5
11
  export type StoredRhineVar<T> = T & RecursiveCrossRhineVar<T> & RhineVar<T>;
6
12
  export type ProxiedRhineVar<T> = StoredRhineVar<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"ProxiedRhineVar.d.ts","sourceRoot":"","sources":["../../../src/core/proxy/ProxiedRhineVar.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,mBAA8B;AAE7C,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;KACrC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC3F,CAAA;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,I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1
+ import RhineVarItem from "./RhineVarItem";
2
+ export type RecursiveCrossRhineVar<T> = {
3
+ [K in keyof T]: T[K] extends object ? RecursiveCrossRhineVar<T[K]> & RhineVarItem<T[K]> : T[K];
4
+ };
5
+ export type StoredRhineVar<T> = T & RecursiveCrossRhineVar<T> & RhineVarItem<T>;
6
+ export type ProxiedRhineVar<T> = StoredRhineVar<T>;
7
+ //# sourceMappingURL=ProxiedRhineVarItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProxiedRhineVarItem.d.ts","sourceRoot":"","sources":["../../../src/core/proxy/ProxiedRhineVarItem.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,uBAAkC;AAErD,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;KACrC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC/F,CAAA;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;AAE/E,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,10 @@
1
1
  import WebsocketRhineConnector from "../connector/WebsocketRhineConnector";
2
- import { ProxiedRhineVar } from "./ProxiedRhineVar";
2
+ import RhineVarItem from "./RhineVarItem";
3
+ import { ProxiedRhineVar, ProxiedRhineVarItem } from "./ProxiedRhineVar";
3
4
  import { Native } from "../native/Native";
5
+ import RhineVar from "./RhineVar";
4
6
  export declare const PROTOCOL_LIST: string[];
5
7
  export declare const DEFAULT_PROTOCOL_LIST: string;
6
- export declare function rhineProxy<T extends object>(data: T, connector?: WebsocketRhineConnector | string | null, overwrite?: boolean | number): ProxiedRhineVar<T>;
7
- export declare function rhineProxyNative<T extends object>(target: Native): ProxiedRhineVar<T>;
8
+ export declare function rhineProxy<T extends object>(data: T | Native, connector: WebsocketRhineConnector | string, overwrite?: boolean | number): ProxiedRhineVar<T>;
9
+ export declare function rhineProxyItem<T extends object>(data: T | Native, parent?: RhineVar<any> | RhineVarItem<any> | null): ProxiedRhineVarItem<T> | ProxiedRhineVar<T>;
8
10
  //# sourceMappingURL=Proxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Proxy.d.ts","sourceRoot":"","sources":["../../../src/core/proxy/Proxy.ts"],"names":[],"mappings":"AACA,OAAO,uBAAgD,6CAAiD;AAKxG,OAAO,EAAC,eAAe,EAAC,0BAAqC;AAC7D,OAAO,EAAC,MAAM,EAAC,yBAA6B;AAY5C,eAAO,MAAM,aAAa,UAAsB,CAAA;AAChD,eAAO,MAAM,qBAAqB,QAAmB,CAAA;AAGrD,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EACzC,IAAI,EAAE,CAAC,EACP,SAAS,GAAE,uBAAuB,GAAG,MAAM,GAAG,IAAW,EACzD,SAAS,GAAE,OAAO,GAAG,MAAc,GAClC,eAAe,CAAC,CAAC,CAAC,CA6CpB;AAGD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,CAoErF"}
1
+ {"version":3,"file":"Proxy.d.ts","sourceRoot":"","sources":["../../../src/core/proxy/Proxy.ts"],"names":[],"mappings":"AACA,OAAO,uBAAgD,6CAAiD;AACxG,OAAO,YAA+C,uBAAkC;AAIxF,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,0BAAqC;AAClF,OAAO,EAAC,MAAM,EAAC,yBAA6B;AAS5C,OAAO,QAAQ,mBAA8B;AAG7C,eAAO,MAAM,aAA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