mirror of
https://github.com/yjs/yjs.git
synced 2026-08-29 10:09:05 +02:00
schemas and upgrade lib0
This commit is contained in:
@@ -76,7 +76,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://docs.yjs.dev",
|
"homepage": "https://docs.yjs.dev",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lib0": "^1.0.0-rc.5"
|
"lib0": "^1.0.0-rc.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^22.14.1",
|
"@types/node": "^22.14.1",
|
||||||
|
|||||||
@@ -122,7 +122,10 @@ export {
|
|||||||
intersectUpdateWithContentIds,
|
intersectUpdateWithContentIds,
|
||||||
intersectUpdateWithContentIdsV2,
|
intersectUpdateWithContentIdsV2,
|
||||||
createDocFromUpdate,
|
createDocFromUpdate,
|
||||||
createDocFromUpdateV2
|
createDocFromUpdateV2,
|
||||||
|
$ytype,
|
||||||
|
$ytypeAny,
|
||||||
|
$attributionManager
|
||||||
} from './internals.js'
|
} from './internals.js'
|
||||||
|
|
||||||
export * from './utils/meta.js'
|
export * from './utils/meta.js'
|
||||||
|
|||||||
@@ -143,6 +143,8 @@ export class AbstractAttributionManager extends ObservableV2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const $attributionManager = AbstractAttributionManager.prototype.$type = s.$type('y:am', AbstractAttributionManager)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @implements AbstractAttributionManager
|
* @implements AbstractAttributionManager
|
||||||
*
|
*
|
||||||
@@ -159,6 +161,8 @@ export class TwosetAttributionManager extends ObservableV2 {
|
|||||||
this.deletes = deletes
|
this.deletes = deletes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get $type () { return $attributionManager }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array<AttributedContent<any>>} contents - where to write the result
|
* @param {Array<AttributedContent<any>>} contents - where to write the result
|
||||||
* @param {number} client
|
* @param {number} client
|
||||||
@@ -204,6 +208,8 @@ export class TwosetAttributionManager extends ObservableV2 {
|
|||||||
* @extends {ObservableV2<{change:(idset:IdSet,origin:any,local:boolean)=>void}>}
|
* @extends {ObservableV2<{change:(idset:IdSet,origin:any,local:boolean)=>void}>}
|
||||||
*/
|
*/
|
||||||
export class NoAttributionsManager extends ObservableV2 {
|
export class NoAttributionsManager extends ObservableV2 {
|
||||||
|
get $type () { return $attributionManager }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array<AttributedContent<any>>} contents - where to write the result
|
* @param {Array<AttributedContent<any>>} contents - where to write the result
|
||||||
* @param {number} _client
|
* @param {number} _client
|
||||||
@@ -449,6 +455,8 @@ export class DiffAttributionManager extends ObservableV2 {
|
|||||||
prevDoc.on('destroy', this._destroyHandler)
|
prevDoc.on('destroy', this._destroyHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get $type () { return $attributionManager }
|
||||||
|
|
||||||
destroy () {
|
destroy () {
|
||||||
super.destroy()
|
super.destroy()
|
||||||
this._nextDoc.off('destroy', this._destroyHandler)
|
this._nextDoc.off('destroy', this._destroyHandler)
|
||||||
@@ -602,6 +610,8 @@ export class SnapshotAttributionManager extends ObservableV2 {
|
|||||||
this.attrs = mergeIdMaps([diffIdMap(inserts, prevSnapshot.ds), deletes])
|
this.attrs = mergeIdMaps([diffIdMap(inserts, prevSnapshot.ds), deletes])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get $type () { return $attributionManager }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array<AttributedContent<any>>} contents - where to write the result
|
* @param {Array<AttributedContent<any>>} contents - where to write the result
|
||||||
* @param {number} client
|
* @param {number} client
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import {
|
|||||||
} from './internals.js'
|
} from './internals.js'
|
||||||
|
|
||||||
import * as contentType from './structs/ContentType.js'
|
import * as contentType from './structs/ContentType.js'
|
||||||
|
|
||||||
import * as traits from 'lib0/traits'
|
import * as traits from 'lib0/traits'
|
||||||
import * as delta from 'lib0/delta'
|
import * as delta from 'lib0/delta'
|
||||||
import * as array from 'lib0/array'
|
import * as array from 'lib0/array'
|
||||||
@@ -1437,6 +1436,14 @@ export class YType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @template {import('lib0/delta').ReadableDeltaConf} DConf
|
||||||
|
* @param {DConf} _dconf
|
||||||
|
* @return {s.Schema<YType<import('lib0/delta').ReadDeltaConf<DConf>>>}
|
||||||
|
*/
|
||||||
|
export const $ytype = _dconf => s.$instanceOf(YType)
|
||||||
|
export const $ytypeAny = s.$instanceOf(YType)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('./utils/UpdateDecoder.js').UpdateDecoderV1 | import('./utils/UpdateDecoder.js').UpdateDecoderV2} decoder
|
* @param {import('./utils/UpdateDecoder.js').UpdateDecoderV1 | import('./utils/UpdateDecoder.js').UpdateDecoderV2} decoder
|
||||||
* @return {YType}
|
* @return {YType}
|
||||||
|
|||||||
@@ -232,7 +232,8 @@ export const testContainsUpdate = _tc => {
|
|||||||
* @param {t.TestCase} _tc
|
* @param {t.TestCase} _tc
|
||||||
*/
|
*/
|
||||||
export const testContainsUpdate2 = _tc => {
|
export const testContainsUpdate2 = _tc => {
|
||||||
const local = new Y.Doc(), remote = new Y.Doc()
|
const local = new Y.Doc()
|
||||||
|
const remote = new Y.Doc()
|
||||||
local.get('t').insert(0, 'abcdefghij')
|
local.get('t').insert(0, 'abcdefghij')
|
||||||
local.get('t').delete(0, 3)
|
local.get('t').delete(0, 3)
|
||||||
Y.applyUpdate(remote, Y.encodeStateAsUpdate(local))
|
Y.applyUpdate(remote, Y.encodeStateAsUpdate(local))
|
||||||
|
|||||||
Reference in New Issue
Block a user