UNPKG

mobx-keystone-yjs

Version:

Yjs bindings for mobx-keystone

18 lines (17 loc) 825 B
import * as Y from "yjs"; import { YjsData } from "./convertYjsDataToJson"; import { PlainArray, PlainObject, PlainValue } from "../plainTypes"; /** * Converts a plain value to a Y.js data structure. * Objects are converted to Y.Maps, arrays to Y.Arrays, primitives are untouched. * Frozen values are a special case and they are kept as immutable plain values. */ export declare function convertJsonToYjsData(v: PlainValue): YjsData; /** * Applies a JSON array to a Y.Array, using the convertJsonToYjsData to convert the values. */ export declare const applyJsonArrayToYArray: (dest: Y.Array<any>, source: PlainArray) => void; /** * Applies a JSON object to a Y.Map, using the convertJsonToYjsData to convert the values. */ export declare const applyJsonObjectToYMap: (dest: Y.Map<any>, source: PlainObject) => void;