mobx-keystone-yjs 1.5.4 → 1.5.5
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 +7 -0
- package/dist/mobx-keystone-yjs.esm.js +197 -139
- package/dist/mobx-keystone-yjs.esm.mjs +197 -139
- package/dist/mobx-keystone-yjs.umd.js +197 -139
- package/dist/types/binding/YjsTextModel.d.ts +5 -4
- package/dist/types/binding/applyMobxKeystonePatchToYjsObject.d.ts +1 -1
- package/dist/types/binding/bindYjsToMobxKeystone.d.ts +1 -1
- package/dist/types/binding/convertJsonToYjsData.d.ts +2 -2
- package/dist/types/binding/convertYjsDataToJson.d.ts +1 -1
- package/dist/types/binding/convertYjsEventToPatches.d.ts +1 -1
- package/dist/types/binding/yjsBindingContext.d.ts +2 -2
- package/dist/types/index.d.ts +6 -6
- package/dist/types/utils/isYjsValueDeleted.d.ts +7 -0
- package/package.json +26 -16
- package/src/binding/YjsTextModel.ts +280 -247
- package/src/binding/applyMobxKeystonePatchToYjsObject.ts +6 -1
- package/src/binding/bindYjsToMobxKeystone.ts +19 -9
- package/src/binding/convertJsonToYjsData.ts +29 -32
- package/src/binding/convertYjsDataToJson.ts +1 -1
- package/src/binding/convertYjsEventToPatches.ts +4 -12
- package/src/index.ts +2 -2
- package/src/utils/isYjsValueDeleted.ts +14 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IAtom } from
|
|
2
|
-
import { Frozen } from
|
|
1
|
+
import { IAtom } from 'mobx';
|
|
2
|
+
import { Frozen } from 'mobx-keystone';
|
|
3
3
|
import * as Y from "yjs";
|
|
4
4
|
export declare const yjsTextModelId = "mobx-keystone-yjs/YjsTextModel";
|
|
5
|
-
declare const YjsTextModel_base: import(
|
|
6
|
-
deltaList: import(
|
|
5
|
+
declare const YjsTextModel_base: import('mobx-keystone')._Model<unknown, {
|
|
6
|
+
deltaList: import('mobx-keystone').OptionalModelProp<Frozen<unknown[]>[]>;
|
|
7
7
|
}, never, never>;
|
|
8
8
|
/**
|
|
9
9
|
* A mobx-keystone model that represents a Yjs.Text object.
|
|
@@ -34,6 +34,7 @@ export declare class YjsTextModel extends YjsTextModel_base {
|
|
|
34
34
|
* Shortcut for `yjsText.toString()`, but computed.
|
|
35
35
|
*/
|
|
36
36
|
get text(): string;
|
|
37
|
+
private deltaListToText;
|
|
37
38
|
protected onInit(): () => void;
|
|
38
39
|
}
|
|
39
40
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Patch } from
|
|
1
|
+
import { Patch } from 'mobx-keystone';
|
|
2
2
|
export declare function applyMobxKeystonePatchToYjsObject(patch: Patch, yjs: unknown): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyDataModel, AnyModel, AnyStandardType, ModelClass, TypeToData } from
|
|
1
|
+
import { AnyDataModel, AnyModel, AnyStandardType, ModelClass, TypeToData } from 'mobx-keystone';
|
|
2
2
|
import * as Y from "yjs";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a bidirectional binding between a Y.js data structure and a mobx-keystone model.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { YjsData } from './convertYjsDataToJson';
|
|
2
|
+
import { PlainArray, PlainObject, PlainValue } from '../plainTypes';
|
|
1
3
|
import * as Y from "yjs";
|
|
2
|
-
import { YjsData } from "./convertYjsDataToJson";
|
|
3
|
-
import { PlainArray, PlainObject, PlainValue } from "../plainTypes";
|
|
4
4
|
/**
|
|
5
5
|
* Converts a plain value to a Y.js data structure.
|
|
6
6
|
* Objects are converted to Y.Maps, arrays to Y.Arrays, primitives are untouched.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyType } from
|
|
1
|
+
import { AnyType } from 'mobx-keystone';
|
|
2
2
|
import * as Y from "yjs";
|
|
3
3
|
/**
|
|
4
4
|
* Context with info on how a mobx-keystone model is bound to a Y.js data structure.
|
|
@@ -32,4 +32,4 @@ export interface YjsBindingContext {
|
|
|
32
32
|
/**
|
|
33
33
|
* Context with info on how a mobx-keystone model is bound to a Y.js data structure.
|
|
34
34
|
*/
|
|
35
|
-
export declare const yjsBindingContext: import(
|
|
35
|
+
export declare const yjsBindingContext: import('mobx-keystone').Context<YjsBindingContext | undefined>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export
|
|
6
|
-
export { MobxKeystoneYjsError } from
|
|
1
|
+
export { bindYjsToMobxKeystone } from './binding/bindYjsToMobxKeystone';
|
|
2
|
+
export { applyJsonArrayToYArray, applyJsonObjectToYMap, convertJsonToYjsData, } from './binding/convertJsonToYjsData';
|
|
3
|
+
export { YjsTextModel, yjsTextModelId } from './binding/YjsTextModel';
|
|
4
|
+
export type { YjsBindingContext } from './binding/yjsBindingContext';
|
|
5
|
+
export { yjsBindingContext } from './binding/yjsBindingContext';
|
|
6
|
+
export { MobxKeystoneYjsError } from './utils/error';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a Y.js value has been deleted or its document destroyed.
|
|
3
|
+
*
|
|
4
|
+
* @param yjsValue The Y.js value to check.
|
|
5
|
+
* @returns `true` if the value is deleted or destroyed, `false` otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isYjsValueDeleted(yjsValue: unknown): boolean;
|
package/package.json
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx-keystone-yjs",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
4
4
|
"description": "Yjs bindings for mobx-keystone",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mobx",
|
|
7
|
+
"mobx-keystone",
|
|
8
|
+
"yjs",
|
|
9
|
+
"crdt",
|
|
10
|
+
"state management"
|
|
11
|
+
],
|
|
6
12
|
"repository": {
|
|
7
13
|
"type": "git",
|
|
8
14
|
"url": "https://github.com/xaviergonz/mobx-keystone.git"
|
|
@@ -35,7 +41,13 @@
|
|
|
35
41
|
"types": "./dist/types/index.d.ts",
|
|
36
42
|
"typings": "./dist/types/index.d.ts",
|
|
37
43
|
"sideEffects": false,
|
|
38
|
-
"files": [
|
|
44
|
+
"files": [
|
|
45
|
+
"src",
|
|
46
|
+
"dist",
|
|
47
|
+
"LICENSE",
|
|
48
|
+
"CHANGELOG.md",
|
|
49
|
+
"README.md"
|
|
50
|
+
],
|
|
39
51
|
"scripts": {
|
|
40
52
|
"quick-build": "tsc",
|
|
41
53
|
"quick-build-tests": "tsc -p test",
|
|
@@ -51,23 +63,21 @@
|
|
|
51
63
|
"yjs": "^13.0.0"
|
|
52
64
|
},
|
|
53
65
|
"devDependencies": {
|
|
54
|
-
"@babel/core": "^7.
|
|
66
|
+
"@babel/core": "^7.28.5",
|
|
55
67
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
56
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
57
|
-
"@babel/preset-env": "^7.
|
|
58
|
-
"@babel/preset-typescript": "^7.
|
|
59
|
-
"@types/jest": "^
|
|
60
|
-
"@types/node": "^
|
|
61
|
-
"babel-jest": "^
|
|
62
|
-
"jest": "^
|
|
68
|
+
"@babel/plugin-proposal-decorators": "^7.28.0",
|
|
69
|
+
"@babel/preset-env": "^7.28.5",
|
|
70
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
71
|
+
"@types/jest": "^30.0.0",
|
|
72
|
+
"@types/node": "^25.0.3",
|
|
73
|
+
"babel-jest": "^30.2.0",
|
|
74
|
+
"jest": "^30.2.0",
|
|
63
75
|
"mobx-keystone": "workspace:packages/lib",
|
|
64
|
-
"
|
|
65
|
-
"shx": "^0.3.4",
|
|
76
|
+
"shx": "^0.4.0",
|
|
66
77
|
"spec.ts": "^1.1.3",
|
|
67
|
-
"ts-jest": "^29.
|
|
78
|
+
"ts-jest": "^29.4.6",
|
|
68
79
|
"ts-node": "^10.9.2",
|
|
69
|
-
"typescript": "^5.
|
|
70
|
-
"vite": "^6.1.0"
|
|
80
|
+
"typescript": "^5.9.3"
|
|
71
81
|
},
|
|
72
82
|
"dependencies": {
|
|
73
83
|
"tslib": "^2.8.1"
|