mobx-keystone-yjs 1.5.3 → 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.
@@ -1,9 +1,9 @@
1
- import { IAtom } from "mobx";
2
- import { Frozen } from "mobx-keystone";
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("mobx-keystone")._Model<unknown, {
6
- deltaList: import("mobx-keystone").OptionalModelProp<Frozen<unknown[]>[]>;
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 "mobx-keystone";
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 "mobx-keystone";
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.
@@ -11,7 +11,7 @@ export declare function bindYjsToMobxKeystone<TType extends AnyStandardType | Mo
11
11
  /**
12
12
  * The bound Y.js data structure.
13
13
  */
14
- yjsObject: Y.Map<unknown> | Y.Array<unknown> | Y.Text;
14
+ yjsObject: Y.Map<any> | Y.Array<any> | Y.Text;
15
15
  /**
16
16
  * The mobx-keystone model type.
17
17
  */
@@ -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.
@@ -10,8 +10,8 @@ export declare function convertJsonToYjsData(v: PlainValue): YjsData;
10
10
  /**
11
11
  * Applies a JSON array to a Y.Array, using the convertJsonToYjsData to convert the values.
12
12
  */
13
- export declare function applyJsonArrayToYArray(dest: Y.Array<YjsData>, source: PlainArray): void;
13
+ export declare const applyJsonArrayToYArray: (dest: Y.Array<any>, source: PlainArray) => void;
14
14
  /**
15
15
  * Applies a JSON object to a Y.Map, using the convertJsonToYjsData to convert the values.
16
16
  */
17
- export declare function applyJsonObjectToYMap(dest: Y.Map<YjsData>, source: PlainObject): void;
17
+ export declare const applyJsonObjectToYMap: (dest: Y.Map<any>, source: PlainObject) => void;
@@ -1,4 +1,4 @@
1
+ import { PlainValue } from '../plainTypes';
1
2
  import * as Y from "yjs";
2
- import { PlainValue } from "../plainTypes";
3
- export type YjsData = Y.Array<YjsData> | Y.Map<YjsData> | Y.Text | PlainValue;
4
- export declare function convertYjsDataToJson(yjsData: YjsData): PlainValue;
3
+ export type YjsData = Y.Array<any> | Y.Map<any> | Y.Text | PlainValue;
4
+ export declare const convertYjsDataToJson: (yjsData: YjsData) => PlainValue;
@@ -1,3 +1,3 @@
1
- import { Patch } from "mobx-keystone";
1
+ import { Patch } from 'mobx-keystone';
2
2
  import * as Y from "yjs";
3
3
  export declare function convertYjsEventToPatches(event: Y.YEvent<any>): Patch[];
@@ -1,4 +1,4 @@
1
- import { AnyType } from "mobx-keystone";
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("mobx-keystone").Context<YjsBindingContext | undefined>;
35
+ export declare const yjsBindingContext: import('mobx-keystone').Context<YjsBindingContext | undefined>;
@@ -1,6 +1,6 @@
1
- export { YjsTextModel, yjsTextModelId } from "./binding/YjsTextModel";
2
- export { bindYjsToMobxKeystone } from "./binding/bindYjsToMobxKeystone";
3
- export { applyJsonArrayToYArray, applyJsonObjectToYMap, convertJsonToYjsData, } from "./binding/convertJsonToYjsData";
4
- export { yjsBindingContext } from "./binding/yjsBindingContext";
5
- export type { YjsBindingContext } from "./binding/yjsBindingContext";
6
- export { MobxKeystoneYjsError } from "./utils/error";
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,6 +1,6 @@
1
1
  {
2
2
  "name": "mobx-keystone-yjs",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "Yjs bindings for mobx-keystone",
5
5
  "keywords": [
6
6
  "mobx",
@@ -63,23 +63,21 @@
63
63
  "yjs": "^13.0.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@babel/core": "^7.26.8",
66
+ "@babel/core": "^7.28.5",
67
67
  "@babel/plugin-proposal-class-properties": "^7.18.6",
68
- "@babel/plugin-proposal-decorators": "^7.25.9",
69
- "@babel/preset-env": "^7.26.8",
70
- "@babel/preset-typescript": "^7.26.0",
71
- "@types/jest": "^29.5.14",
72
- "@types/node": "^22.13.1",
73
- "babel-jest": "^29.7.0",
74
- "jest": "^29.7.0",
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",
75
75
  "mobx-keystone": "workspace:packages/lib",
76
- "rollup-plugin-typescript2": "^0.36.0",
77
- "shx": "^0.3.4",
76
+ "shx": "^0.4.0",
78
77
  "spec.ts": "^1.1.3",
79
- "ts-jest": "^29.2.5",
78
+ "ts-jest": "^29.4.6",
80
79
  "ts-node": "^10.9.2",
81
- "typescript": "^5.7.3",
82
- "vite": "^6.1.0"
80
+ "typescript": "^5.9.3"
83
81
  },
84
82
  "dependencies": {
85
83
  "tslib": "^2.8.1"