@y/y 14.0.0-rc.2 → 14.0.0-rc.21
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/README.md +36 -12
- package/dist/src/index.d.ts +24 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/structs/AbstractStruct.d.ts +14 -17
- package/dist/src/structs/AbstractStruct.d.ts.map +1 -1
- package/dist/src/structs/GC.d.ts +9 -14
- package/dist/src/structs/GC.d.ts.map +1 -1
- package/dist/src/structs/Item.d.ts +569 -31
- package/dist/src/structs/Item.d.ts.map +1 -1
- package/dist/src/structs/Skip.d.ts +9 -11
- package/dist/src/structs/Skip.d.ts.map +1 -1
- package/dist/src/utils/BlockSet.d.ts +8 -7
- package/dist/src/utils/BlockSet.d.ts.map +1 -1
- package/dist/src/utils/Doc.d.ts +4 -9
- package/dist/src/utils/Doc.d.ts.map +1 -1
- package/dist/src/utils/ID.d.ts +0 -1
- package/dist/src/utils/ID.d.ts.map +1 -1
- package/dist/src/utils/RelativePosition.d.ts +2 -5
- package/dist/src/utils/RelativePosition.d.ts.map +1 -1
- package/dist/src/utils/Renderer.d.ts +144 -0
- package/dist/src/utils/Renderer.d.ts.map +1 -0
- package/dist/src/utils/Snapshot.d.ts +7 -11
- package/dist/src/utils/Snapshot.d.ts.map +1 -1
- package/dist/src/utils/StructStore.d.ts +45 -23
- package/dist/src/utils/StructStore.d.ts.map +1 -1
- package/dist/src/utils/Transaction.d.ts +11 -21
- package/dist/src/utils/Transaction.d.ts.map +1 -1
- package/dist/src/utils/UndoManager.d.ts +13 -14
- package/dist/src/utils/UndoManager.d.ts.map +1 -1
- package/dist/src/utils/UpdateDecoder.d.ts +1 -1
- package/dist/src/utils/UpdateDecoder.d.ts.map +1 -1
- package/dist/src/utils/UpdateEncoder.d.ts +0 -1
- package/dist/src/utils/UpdateEncoder.d.ts.map +1 -1
- package/dist/src/utils/YEvent.d.ts +22 -26
- package/dist/src/utils/YEvent.d.ts.map +1 -1
- package/dist/src/utils/content-helper.d.ts +2 -0
- package/dist/src/utils/content-helper.d.ts.map +1 -0
- package/dist/src/utils/delta-helpers.d.ts +2 -3
- package/dist/src/utils/delta-helpers.d.ts.map +1 -1
- package/dist/src/utils/encoding-helpers.d.ts +6 -0
- package/dist/src/utils/encoding-helpers.d.ts.map +1 -0
- package/dist/src/utils/encoding.d.ts +16 -18
- package/dist/src/utils/encoding.d.ts.map +1 -1
- package/dist/src/utils/ids.d.ts +331 -0
- package/dist/src/utils/ids.d.ts.map +1 -0
- package/dist/src/utils/isParentOf.d.ts +1 -2
- package/dist/src/utils/isParentOf.d.ts.map +1 -1
- package/dist/src/utils/logging.d.ts +0 -1
- package/dist/src/utils/logging.d.ts.map +1 -1
- package/dist/src/utils/meta.d.ts +15 -64
- package/dist/src/utils/meta.d.ts.map +1 -1
- package/dist/src/utils/renderer-helpers.d.ts +99 -0
- package/dist/src/utils/renderer-helpers.d.ts.map +1 -0
- package/dist/src/utils/schemas.d.ts +3 -0
- package/dist/src/utils/schemas.d.ts.map +1 -0
- package/dist/src/utils/transaction-helpers.d.ts +18 -0
- package/dist/src/utils/transaction-helpers.d.ts.map +1 -0
- package/dist/src/utils/updates.d.ts +19 -25
- package/dist/src/utils/updates.d.ts.map +1 -1
- package/dist/src/ytype.d.ts +144 -41
- package/dist/src/ytype.d.ts.map +1 -1
- package/global.d.ts +53 -0
- package/package.json +12 -16
- package/src/index.js +32 -124
- package/src/structs/AbstractStruct.js +21 -16
- package/src/structs/GC.js +15 -20
- package/src/structs/Item.js +992 -318
- package/src/structs/Skip.js +16 -19
- package/src/utils/BlockSet.js +20 -20
- package/src/utils/Doc.js +18 -29
- package/src/utils/ID.js +0 -2
- package/src/utils/RelativePosition.js +15 -25
- package/src/utils/{AttributionManager.js → Renderer.js} +42 -197
- package/src/utils/Snapshot.js +15 -37
- package/src/utils/StructStore.js +89 -227
- package/src/utils/Transaction.js +89 -321
- package/src/utils/UndoManager.js +157 -19
- package/src/utils/UpdateDecoder.js +2 -3
- package/src/utils/UpdateEncoder.js +0 -4
- package/src/utils/YEvent.js +20 -26
- package/src/utils/content-helper.js +0 -0
- package/src/utils/delta-helpers.js +21 -42
- package/src/utils/encoding-helpers.js +110 -0
- package/src/utils/encoding.js +197 -122
- package/src/utils/ids.js +1527 -0
- package/src/utils/isParentOf.js +2 -4
- package/src/utils/logging.js +0 -4
- package/src/utils/meta.js +57 -46
- package/src/utils/renderer-helpers.js +110 -0
- package/src/utils/schemas.js +3 -0
- package/src/utils/transaction-helpers.js +413 -0
- package/src/utils/updates.js +24 -146
- package/src/ytype.js +626 -255
- package/tests/testHelper.js +10 -12
- package/dist/src/internals.d.ts +0 -36
- package/dist/src/internals.d.ts.map +0 -1
- package/dist/src/structs/ContentAny.d.ts +0 -67
- package/dist/src/structs/ContentAny.d.ts.map +0 -1
- package/dist/src/structs/ContentBinary.d.ts +0 -64
- package/dist/src/structs/ContentBinary.d.ts.map +0 -1
- package/dist/src/structs/ContentDeleted.d.ts +0 -64
- package/dist/src/structs/ContentDeleted.d.ts.map +0 -1
- package/dist/src/structs/ContentDoc.d.ts +0 -72
- package/dist/src/structs/ContentDoc.d.ts.map +0 -1
- package/dist/src/structs/ContentEmbed.d.ts +0 -67
- package/dist/src/structs/ContentEmbed.d.ts.map +0 -1
- package/dist/src/structs/ContentFormat.d.ts +0 -69
- package/dist/src/structs/ContentFormat.d.ts.map +0 -1
- package/dist/src/structs/ContentJSON.d.ts +0 -70
- package/dist/src/structs/ContentJSON.d.ts.map +0 -1
- package/dist/src/structs/ContentString.d.ts +0 -70
- package/dist/src/structs/ContentString.d.ts.map +0 -1
- package/dist/src/structs/ContentType.d.ts +0 -77
- package/dist/src/structs/ContentType.d.ts.map +0 -1
- package/dist/src/utils/AttributionManager.d.ts +0 -238
- package/dist/src/utils/AttributionManager.d.ts.map +0 -1
- package/dist/src/utils/IdMap.d.ts +0 -164
- package/dist/src/utils/IdMap.d.ts.map +0 -1
- package/dist/src/utils/IdSet.d.ts +0 -163
- package/dist/src/utils/IdSet.d.ts.map +0 -1
- package/dist/tests/IdMap.tests.d.ts +0 -9
- package/dist/tests/IdMap.tests.d.ts.map +0 -1
- package/dist/tests/IdSet.tests.d.ts +0 -9
- package/dist/tests/IdSet.tests.d.ts.map +0 -1
- package/dist/tests/attribution.tests.d.ts +0 -9
- package/dist/tests/attribution.tests.d.ts.map +0 -1
- package/dist/tests/compatibility.tests.d.ts +0 -5
- package/dist/tests/compatibility.tests.d.ts.map +0 -1
- package/dist/tests/delta.tests.d.ts +0 -7
- package/dist/tests/delta.tests.d.ts.map +0 -1
- package/dist/tests/doc.tests.d.ts +0 -13
- package/dist/tests/doc.tests.d.ts.map +0 -1
- package/dist/tests/encoding.tests.d.ts +0 -5
- package/dist/tests/encoding.tests.d.ts.map +0 -1
- package/dist/tests/index.d.ts +0 -2
- package/dist/tests/index.d.ts.map +0 -1
- package/dist/tests/relativePositions.tests.d.ts +0 -11
- package/dist/tests/relativePositions.tests.d.ts.map +0 -1
- package/dist/tests/snapshot.tests.d.ts +0 -14
- package/dist/tests/snapshot.tests.d.ts.map +0 -1
- package/dist/tests/testHelper.d.ts +0 -171
- package/dist/tests/testHelper.d.ts.map +0 -1
- package/dist/tests/undo-redo.tests.d.ts +0 -27
- package/dist/tests/undo-redo.tests.d.ts.map +0 -1
- package/dist/tests/updates.tests.d.ts +0 -26
- package/dist/tests/updates.tests.d.ts.map +0 -1
- package/dist/tests/y-array.tests.d.ts +0 -43
- package/dist/tests/y-array.tests.d.ts.map +0 -1
- package/dist/tests/y-map.tests.d.ts +0 -42
- package/dist/tests/y-map.tests.d.ts.map +0 -1
- package/dist/tests/y-text.tests.d.ts +0 -49
- package/dist/tests/y-text.tests.d.ts.map +0 -1
- package/dist/tests/y-xml.tests.d.ts +0 -14
- package/dist/tests/y-xml.tests.d.ts.map +0 -1
- package/src/internals.js +0 -35
- package/src/structs/ContentAny.js +0 -115
- package/src/structs/ContentBinary.js +0 -93
- package/src/structs/ContentDeleted.js +0 -101
- package/src/structs/ContentDoc.js +0 -141
- package/src/structs/ContentEmbed.js +0 -98
- package/src/structs/ContentFormat.js +0 -105
- package/src/structs/ContentJSON.js +0 -119
- package/src/structs/ContentString.js +0 -113
- package/src/structs/ContentType.js +0 -152
- package/src/utils/IdMap.js +0 -673
- package/src/utils/IdSet.js +0 -825
package/dist/src/utils/meta.d.ts
CHANGED
|
@@ -1,71 +1,22 @@
|
|
|
1
|
-
export function createContentIds(inserts?:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export function
|
|
10
|
-
|
|
11
|
-
deletes: idset.IdSet;
|
|
12
|
-
};
|
|
13
|
-
export function createContentIdsFromDocDiff(ydocPrev: import("./Doc.js").Doc, ydocNext: import("./Doc.js").Doc): {
|
|
14
|
-
inserts: idset.IdSet;
|
|
15
|
-
deletes: idset.IdSet;
|
|
16
|
-
};
|
|
17
|
-
export function excludeContentIds(content: ContentIds, excludeContent: ContentIds): {
|
|
18
|
-
inserts: idset.IdSet;
|
|
19
|
-
deletes: idset.IdSet;
|
|
20
|
-
};
|
|
21
|
-
export function excludeContentMap(content: ContentMap, excludeContent: ContentIds | ContentMap): {
|
|
22
|
-
inserts: idmap.IdMap<any>;
|
|
23
|
-
deletes: idmap.IdMap<any>;
|
|
24
|
-
};
|
|
25
|
-
export function mergeContentMaps(contents: Array<ContentMap>): {
|
|
26
|
-
inserts: idmap.IdMap<any>;
|
|
27
|
-
deletes: idmap.IdMap<any>;
|
|
28
|
-
};
|
|
29
|
-
export function mergeContentIds(contents: Array<ContentIds>): {
|
|
30
|
-
inserts: idset.IdSet;
|
|
31
|
-
deletes: idset.IdSet;
|
|
32
|
-
};
|
|
33
|
-
export function createContentMap(inserts: import("./IdMap.js").IdMap<any>, deletes: import("./IdMap.js").IdMap<any>): {
|
|
34
|
-
inserts: idmap.IdMap<any>;
|
|
35
|
-
deletes: idmap.IdMap<any>;
|
|
36
|
-
};
|
|
37
|
-
export function createContentMapFromContentIds(contentIds: ContentIds, insertAttrs: Array<idmap.ContentAttribute<any>>, deleteAttrs?: Array<idmap.ContentAttribute<any>>): {
|
|
38
|
-
inserts: idmap.IdMap<any>;
|
|
39
|
-
deletes: idmap.IdMap<any>;
|
|
40
|
-
};
|
|
1
|
+
export function createContentIds(inserts?: IdSet, deletes?: IdSet): ContentIds;
|
|
2
|
+
export function createContentIdsFromContentMap(contentMap: ContentMap): import("./ids.js").ContentIds;
|
|
3
|
+
export function createContentIdsFromDoc(ydoc: import("./Doc.js").Doc): import("./ids.js").ContentIds;
|
|
4
|
+
export function createContentIdsFromDocDiff(ydocPrev: import("./Doc.js").Doc, ydocNext: import("./Doc.js").Doc): import("./ids.js").ContentIds;
|
|
5
|
+
export function excludeContentIds(content: ContentIds, excludeContent: ContentIds): import("./ids.js").ContentIds;
|
|
6
|
+
export function excludeContentMap(content: ContentMap, excludeContent: ContentIds | ContentMap): import("./ids.js").ContentMap;
|
|
7
|
+
export function mergeContentMaps(contents: Array<ContentMap>): import("./ids.js").ContentMap;
|
|
8
|
+
export function mergeContentIds(contents: Array<ContentIds>): import("./ids.js").ContentIds;
|
|
9
|
+
export function createContentMap(inserts: IdMap<any>, deletes: IdMap<any>): ContentMap;
|
|
10
|
+
export function createContentMapFromContentIds(contentIds: ContentIds, insertAttrs: Array<ContentAttribute<any>>, deleteAttrs?: Array<ContentAttribute<any>>): import("./ids.js").ContentMap;
|
|
41
11
|
export function writeContentIds(encoder: import("./UpdateEncoder.js").IdSetEncoder, contentIds: ContentIds): void;
|
|
42
12
|
export function encodeContentIds(contentIds: ContentIds): Uint8Array<ArrayBuffer>;
|
|
43
13
|
export function readContentIds(decoder: import("./UpdateDecoder.js").IdSetDecoder): ContentIds;
|
|
44
|
-
export function decodeContentIds(buf: Uint8Array<any>): ContentIds;
|
|
14
|
+
export function decodeContentIds(buf: Uint8Array<any>): import("./ids.js").ContentIds;
|
|
45
15
|
export function writeContentMap(encoder: import("./UpdateEncoder.js").IdSetEncoder, contentMap: ContentMap): void;
|
|
46
16
|
export function readContentMap(decoder: import("./UpdateDecoder.js").IdSetDecoder): ContentMap;
|
|
47
17
|
export function encodeContentMap(contentMap: ContentMap): Uint8Array<ArrayBuffer>;
|
|
48
|
-
export function intersectContentMap(mapA: ContentMap, mapB: ContentMap | ContentIds):
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export function intersectContentIds(setA: ContentIds, setB: ContentIds | ContentMap): {
|
|
53
|
-
inserts: idset.IdSet;
|
|
54
|
-
deletes: idset.IdSet;
|
|
55
|
-
};
|
|
56
|
-
export function decodeContentMap(buf: Uint8Array<any>): ContentMap;
|
|
57
|
-
export function filterContentMap(contentMap: ContentMap, insertPredicate: (c: Array<idmap.ContentAttribute<any>>) => boolean, deletePredicate: (c: Array<idmap.ContentAttribute<any>>) => boolean): {
|
|
58
|
-
inserts: idmap.IdMap<any>;
|
|
59
|
-
deletes: idmap.IdMap<any>;
|
|
60
|
-
};
|
|
61
|
-
export type ContentIds = {
|
|
62
|
-
inserts: import("./IdSet.js").IdSet;
|
|
63
|
-
deletes: import("./IdSet.js").IdSet;
|
|
64
|
-
};
|
|
65
|
-
export type ContentMap = {
|
|
66
|
-
inserts: import("./IdMap.js").IdMap<any>;
|
|
67
|
-
deletes: import("./IdMap.js").IdMap<any>;
|
|
68
|
-
};
|
|
69
|
-
import * as idset from './IdSet.js';
|
|
70
|
-
import * as idmap from './IdMap.js';
|
|
18
|
+
export function intersectContentMap(mapA: ContentMap, mapB: ContentMap | ContentIds): import("./ids.js").ContentMap;
|
|
19
|
+
export function intersectContentIds(setA: ContentIds, setB: ContentIds | ContentMap): import("./ids.js").ContentIds;
|
|
20
|
+
export function decodeContentMap(buf: Uint8Array<any>): import("./ids.js").ContentMap;
|
|
21
|
+
export function filterContentMap(contentMap: ContentMap, insertPredicate: (c: Array<ContentAttribute<any>>) => boolean, deletePredicate: (c: Array<ContentAttribute<any>>) => boolean): import("./ids.js").ContentMap;
|
|
71
22
|
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/utils/meta.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/utils/meta.js"],"names":[],"mappings":"AAgCO,2CAJI,KAAK,YACL,KAAK,GACJ,UAAU,CAEsF;AAKrG,2DAFI,UAAU,iCAKpB;AAKM,8CAFI,OAAO,UAAU,EAAE,GAAG,iCAKhC;AAMM,sDAHI,OAAO,UAAU,EAAE,GAAG,YACtB,OAAO,UAAU,EAAE,GAAG,iCAGwD;AAMlF,2CAHI,UAAU,kBACV,UAAU,iCAGqG;AAMnH,2CAHI,UAAU,kBACV,UAAU,GAAG,UAAU,iCAKjC;AAKM,2CAFI,KAAK,CAAC,UAAU,CAAC,iCAK3B;AAKM,0CAFI,KAAK,CAAC,UAAU,CAAC,iCAK3B;AAOM,0CAJI,KAAK,CAAC,GAAG,CAAC,WACV,KAAK,CAAC,GAAG,CAAC,GACT,UAAU,CAEsD;AAOrE,2DAJI,UAAU,eACV,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,gBAC5B,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,iCAKtC;AAMM,yCAHI,OAAO,oBAAoB,EAAE,YAAY,cACzC,UAAU,QAKpB;AAKM,6CAFI,UAAU,2BAMpB;AAQM,wCAHI,OAAO,oBAAoB,EAAE,YAAY,GACxC,UAAU,CAKrB;AAKM,sCAFI,UAAU,CAAC,GAAG,CAAC,iCAE4E;AAQ/F,yCAHI,OAAO,oBAAoB,EAAE,YAAY,cACzC,UAAU,QAKpB;AAQM,wCAHI,OAAO,oBAAoB,EAAE,YAAY,GACxC,UAAU,CAKrB;AAKM,6CAFI,UAAU,2BAMpB;AAMM,0CAHI,UAAU,QACV,UAAU,GAAC,UAAU,iCAK/B;AAMM,0CAHI,UAAU,QACV,UAAU,GAAC,UAAU,iCAK/B;AAKM,sCAFI,UAAU,CAAC,GAAG,CAAC,iCAE4E;AAQ/F,6CAJI,UAAU,mBACV,CAAC,CAAC,EAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,KAAG,OAAO,mBACzC,CAAC,CAAC,EAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,KAAG,OAAO,iCAEkJ"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export const attributionJsonSchema: s.Schema<{
|
|
2
|
+
insert?: string[] | undefined;
|
|
3
|
+
insertAt?: number | undefined;
|
|
4
|
+
delete?: string[] | undefined;
|
|
5
|
+
deleteAt?: number | undefined;
|
|
6
|
+
format?: {
|
|
7
|
+
[x: string]: string[];
|
|
8
|
+
} | undefined;
|
|
9
|
+
formatAt?: number | undefined;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* @todo rename this to `insertBy`, `insertAt`, ..
|
|
13
|
+
*
|
|
14
|
+
* @typedef {s.Unwrap<typeof attributionJsonSchema>} Attribution
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @template T
|
|
18
|
+
*/
|
|
19
|
+
export class AttributedContent<T> {
|
|
20
|
+
/**
|
|
21
|
+
* @param {AbstractContent} content
|
|
22
|
+
* @param {number} clock
|
|
23
|
+
* @param {boolean} deleted
|
|
24
|
+
* @param {Array<ContentAttribute<T>> | null} attrs
|
|
25
|
+
* @param {0|1|2} renderBehavior
|
|
26
|
+
*/
|
|
27
|
+
constructor(content: AbstractContent, clock: number, deleted: boolean, attrs: Array<ContentAttribute<T>> | null, renderBehavior: 0 | 1 | 2);
|
|
28
|
+
content: import("../structs/Item.js").AbstractContent;
|
|
29
|
+
clock: number;
|
|
30
|
+
deleted: boolean;
|
|
31
|
+
attrs: import("./ids.js").ContentAttribute<T>[] | null;
|
|
32
|
+
render: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Abstract base class for renderers. A renderer renders Content (with Attributions) to a delta.
|
|
36
|
+
*
|
|
37
|
+
* Should fire an event when the attributions changed _after_ the original change happens. This
|
|
38
|
+
* Event will be used to update the attribution on the current content.
|
|
39
|
+
*
|
|
40
|
+
* @extends {ObservableV2<{change:(idset:IdSet,origin:any,local:boolean)=>void}>}
|
|
41
|
+
*/
|
|
42
|
+
export class AbstractRenderer extends ObservableV2<{
|
|
43
|
+
change: (idset: IdSet, origin: any, local: boolean) => void;
|
|
44
|
+
}> {
|
|
45
|
+
constructor();
|
|
46
|
+
/**
|
|
47
|
+
* @param {Array<AttributedContent<any>>} _contents - where to write the result
|
|
48
|
+
* @param {number} _client
|
|
49
|
+
* @param {number} _clock
|
|
50
|
+
* @param {boolean} _deleted
|
|
51
|
+
* @param {AbstractContent} _content
|
|
52
|
+
* @param {0|1|2} _shouldRender - 0: if undeleted or attributed, render as a retain operation. 1: render only if undeleted or attributed. 2: render as insert operation (if unattributed and deleted, render as delete).
|
|
53
|
+
*/
|
|
54
|
+
readContent(_contents: Array<AttributedContent<any>>, _client: number, _clock: number, _deleted: boolean, _content: AbstractContent, _shouldRender: 0 | 1 | 2): void;
|
|
55
|
+
/**
|
|
56
|
+
* Calculate the length of the attributed content. This is used by iterators that walk through the
|
|
57
|
+
* content.
|
|
58
|
+
*
|
|
59
|
+
* If the content is not countable, it should return 0.
|
|
60
|
+
*
|
|
61
|
+
* @param {Item} _item
|
|
62
|
+
* @return {number}
|
|
63
|
+
*/
|
|
64
|
+
contentLength(_item: Item): number;
|
|
65
|
+
$type: s.Schema<AbstractRenderer>;
|
|
66
|
+
}
|
|
67
|
+
export const $renderer: s.Schema<AbstractRenderer>;
|
|
68
|
+
/**
|
|
69
|
+
* The default renderer. Renders content as-is, without looking up any attributions.
|
|
70
|
+
*
|
|
71
|
+
* @implements AbstractRenderer
|
|
72
|
+
*
|
|
73
|
+
* @extends {ObservableV2<{change:(idset:IdSet,origin:any,local:boolean)=>void}>}
|
|
74
|
+
*/
|
|
75
|
+
export class BaseRenderer extends ObservableV2<{
|
|
76
|
+
change: (idset: IdSet, origin: any, local: boolean) => void;
|
|
77
|
+
}> implements AbstractRenderer {
|
|
78
|
+
constructor();
|
|
79
|
+
get $type(): s.Schema<AbstractRenderer>;
|
|
80
|
+
/**
|
|
81
|
+
* @param {Array<AttributedContent<any>>} contents - where to write the result
|
|
82
|
+
* @param {number} _client
|
|
83
|
+
* @param {number} clock
|
|
84
|
+
* @param {boolean} deleted
|
|
85
|
+
* @param {AbstractContent} content
|
|
86
|
+
* @param {0|1|2} shouldRender - whether this should render or just result in a `retain` operation
|
|
87
|
+
*/
|
|
88
|
+
readContent(contents: Array<AttributedContent<any>>, _client: number, clock: number, deleted: boolean, content: AbstractContent, shouldRender: 0 | 1 | 2): void;
|
|
89
|
+
/**
|
|
90
|
+
* @param {Item} item
|
|
91
|
+
* @return {number}
|
|
92
|
+
*/
|
|
93
|
+
contentLength(item: Item): number;
|
|
94
|
+
}
|
|
95
|
+
export const baseRenderer: BaseRenderer;
|
|
96
|
+
export type Attribution = s.Unwrap<typeof attributionJsonSchema>;
|
|
97
|
+
import * as s from 'lib0/schema';
|
|
98
|
+
import { ObservableV2 } from 'lib0/observable';
|
|
99
|
+
//# sourceMappingURL=renderer-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer-helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/renderer-helpers.js"],"names":[],"mappings":"AAIA;;;;;;;;;GAOE;AAEF;;;;GAIG;AAEH;;GAEG;AACH,+BAFa,CAAC;IAGZ;;;;;;OAMG;IACH,qBANW,eAAe,SACf,MAAM,WACN,OAAO,SACP,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,kBACjC,CAAC,GAAC,CAAC,GAAC,CAAC,EAQf;IALC,sDAAsB;IACtB,cAAkB;IAClB,iBAAsB;IACtB,uDAAkB;IAClB,gBAAwG;CAE3G;AAED;;;;;;;GAOG;AACH;YAFkC,CAAC,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,GAAG,EAAC,KAAK,EAAC,OAAO,KAAG,IAAI;;;IAG5E;;;;;;;OAOG;IACH,uBAPW,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,WAC7B,MAAM,UACN,MAAM,YACN,OAAO,YACP,eAAe,iBACf,CAAC,GAAC,CAAC,GAAC,CAAC,QAIf;IAED;;;;;;;;OAQG;IACH,qBAHW,IAAI,GACH,MAAM,CAIjB;IAGsB,kCAAgC;CAFxD;AAED,mDAA4F;AAE5F;;;;;;GAMG;AACH;YAFkC,CAAC,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,GAAG,EAAC,KAAK,EAAC,OAAO,KAAG,IAAI;cAF/D,gBAAgB;;IAK7B,wCAAiC;IAEjC;;;;;;;OAOG;IACH,sBAPW,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,WAC7B,MAAM,SACN,MAAM,WACN,OAAO,WACP,eAAe,gBACf,CAAC,GAAC,CAAC,GAAC,CAAC,QAMf;IAED;;;OAGG;IACH,oBAHW,IAAI,GACH,MAAM,CAIjB;CACF;AAED,wCAA8C;0BA7FjC,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC;mBAhBhC,aAAa;6BAEH,iBAAiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/utils/schemas.js"],"names":[],"mappings":"AAEA,oBAAgC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAA6B;mBAFvD,aAAa"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function findIndexSS(structs: Array<Item | GC | Skip>, clock: number): number;
|
|
2
|
+
export function findIndexCleanStart(transaction: Transaction | null, structs: Array<Item | GC | Skip>, clock: number): number;
|
|
3
|
+
export function getItemCleanStart(transaction: Transaction, id: ID): Item;
|
|
4
|
+
export function getItemCleanEnd(transaction: Transaction, store: StructStore, id: ID): Item;
|
|
5
|
+
export function replaceStruct(tr: Transaction, struct: GC | Item, newStruct: GC | Item): void;
|
|
6
|
+
export function iterateStructs(transaction: Transaction, structs: Array<Item | GC>, clockStart: number, len: number, f: (arg0: GC | Item) => void): void;
|
|
7
|
+
export function iterateStructsWithoutSplits(structs: Array<Item | GC>, clockStart: number, len: number, f: (struct: GC | Item | Skip, offset: number, len: number) => void): void;
|
|
8
|
+
export function splitStruct(transaction: Transaction | null, leftStruct: Item | GC | Skip, diff: number): GC | Item | Skip;
|
|
9
|
+
export function nextID(transaction: Transaction): import("./ID.js").ID;
|
|
10
|
+
export function addChangedTypeToTransaction(transaction: Transaction, type: YType, parentSub: string | null): void;
|
|
11
|
+
export function tryToMergeWithLefts(structs: Array<GC | Item | Skip>, pos: number): number;
|
|
12
|
+
export function tryGcDeleteSet(tr: Transaction, ds: IdSet, gcFilter: (arg0: Item) => boolean): void;
|
|
13
|
+
export function tryMerge(ds: IdSet, store: StructStore): void;
|
|
14
|
+
export function tryGc(tr: Transaction, idset: IdSet, gcFilter: (arg0: Item) => boolean): void;
|
|
15
|
+
export function cleanupContextlessFormattingGap(transaction: Transaction, item: Item | null): 0 | undefined;
|
|
16
|
+
export function updateCurrentFormats(currentFormats: Map<string, any>, { key, value }: ContentFormat): void;
|
|
17
|
+
export function cleanupFormattingGap(transaction: Transaction, start: Item, curr: Item | null, startFormats: Map<string, any>, currFormats: Map<string, any>): number;
|
|
18
|
+
//# sourceMappingURL=transaction-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/transaction-helpers.js"],"names":[],"mappings":"AAqBO,qCAPI,KAAK,CAAC,IAAI,GAAC,EAAE,GAAC,IAAI,CAAC,SACnB,MAAM,GACL,MAAM,CAiCjB;AAOM,iDAJI,WAAW,OAAC,WACZ,KAAK,CAAC,IAAI,GAAC,EAAE,GAAC,IAAI,CAAC,SACnB,MAAM,UAUhB;AAYM,+CAPI,WAAW,MACX,EAAE,GACD,IAAI,CAQf;AAaM,6CARI,WAAW,SACX,WAAW,MACX,EAAE,GACD,IAAI,CAaf;AAWM,kCAPI,WAAW,UACX,EAAE,GAAC,IAAI,aACP,EAAE,GAAC,IAAI,QASjB;AAaM,4CARI,WAAW,WACX,KAAK,CAAC,IAAI,GAAC,EAAE,CAAC,cACd,MAAM,OACN,MAAM,KACN,CAAS,IAAO,EAAP,EAAE,GAAC,IAAI,KAAE,IAAI,QAkBhC;AAaM,qDAPI,KAAK,CAAC,IAAI,GAAC,EAAE,CAAC,cACd,MAAM,OACN,MAAM,KACN,CAAC,MAAM,EAAE,EAAE,GAAC,IAAI,GAAC,IAAI,EAAE,MAAM,EAAC,MAAM,EAAE,GAAG,EAAC,MAAM,KAAG,IAAI,QAkBjE;AAYM,yCARI,WAAW,OAAC,cACZ,IAAI,GAAC,EAAE,GAAC,IAAI,QACZ,MAAM,GACL,EAAE,GAAC,IAAI,GAAC,IAAI,CAavB;AAQM,oCALI,WAAW,wBAQrB;AAUM,yDAJI,WAAW,QACX,KAAK,aACL,MAAM,GAAC,IAAI,QAOrB;AAOM,6CAJI,KAAK,CAAC,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,OACvB,MAAM,GACL,MAAM,CAuBjB;AAOM,mCAJI,WAAW,MACX,KAAK,YACL,CAAS,IAAI,EAAJ,IAAI,KAAE,OAAO,QAwBhC;AAMM,6BAHI,KAAK,SACL,WAAW,QAqBrB;AAOM,0BAJI,WAAW,SACX,KAAK,YACL,CAAS,IAAI,EAAJ,IAAI,KAAE,OAAO,QAKhC;AAMM,6DAHI,WAAW,QACX,IAAI,GAAG,IAAI,iBAsBrB;AASM,qDANI,GAAG,CAAC,MAAM,EAAC,GAAG,CAAC,kBACf,aAAa,QAWvB;AAeM,kDATI,WAAW,SACX,IAAI,QACJ,IAAI,GAAC,IAAI,gBACT,GAAG,CAAC,MAAM,EAAC,GAAG,CAAC,eACf,GAAG,CAAC,MAAM,EAAC,GAAG,CAAC,GACd,MAAM,CAqDjB"}
|
|
@@ -20,11 +20,11 @@ export function logUpdate(update: Uint8Array): void;
|
|
|
20
20
|
export function logUpdateV2(update: Uint8Array, YDecoder?: typeof UpdateDecoderV2 | typeof UpdateDecoderV1): void;
|
|
21
21
|
export function decodeUpdate(update: Uint8Array): {
|
|
22
22
|
structs: (GC | Item | Skip)[];
|
|
23
|
-
ds:
|
|
23
|
+
ds: import("./ids.js").IdSet;
|
|
24
24
|
};
|
|
25
25
|
export function decodeUpdateV2(update: Uint8Array, YDecoder?: typeof UpdateDecoderV2 | typeof UpdateDecoderV1): {
|
|
26
26
|
structs: (GC | Item | Skip)[];
|
|
27
|
-
ds:
|
|
27
|
+
ds: import("./ids.js").IdSet;
|
|
28
28
|
};
|
|
29
29
|
export class LazyStructWriter {
|
|
30
30
|
/**
|
|
@@ -34,7 +34,7 @@ export class LazyStructWriter {
|
|
|
34
34
|
currClient: number;
|
|
35
35
|
startClock: number;
|
|
36
36
|
written: number;
|
|
37
|
-
encoder:
|
|
37
|
+
encoder: UpdateEncoderV1 | UpdateEncoderV2;
|
|
38
38
|
/**
|
|
39
39
|
* We want to write operations lazily, but also we need to know beforehand how many operations we want to write for each client.
|
|
40
40
|
*
|
|
@@ -50,24 +50,20 @@ export class LazyStructWriter {
|
|
|
50
50
|
restEncoder: Uint8Array;
|
|
51
51
|
}>;
|
|
52
52
|
}
|
|
53
|
-
export function mergeUpdates(updates: Array<Uint8Array<ArrayBuffer>>): Uint8Array<ArrayBuffer>;
|
|
54
53
|
export function encodeStateVectorFromUpdateV2(update: Uint8Array, YEncoder?: typeof IdSetEncoderV1 | typeof IdSetEncoderV2, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2): Uint8Array<ArrayBuffer>;
|
|
55
54
|
export function encodeStateVectorFromUpdate(update: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
56
|
-
export function createContentIdsFromUpdateV2(update: Uint8Array, YDecoder?: typeof UpdateDecoderV2 | typeof UpdateDecoderV1):
|
|
57
|
-
export function createContentIdsFromUpdate(update: Uint8Array):
|
|
58
|
-
export function sliceStruct(left: Item | GC | Skip, diff: number): Item | GC;
|
|
59
|
-
export function
|
|
60
|
-
export function
|
|
61
|
-
export function diffUpdate(update: Uint8Array<ArrayBuffer>, sv: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
|
|
55
|
+
export function createContentIdsFromUpdateV2(update: Uint8Array, YDecoder?: typeof UpdateDecoderV2 | typeof UpdateDecoderV1): ContentIds;
|
|
56
|
+
export function createContentIdsFromUpdate(update: Uint8Array): ContentIds;
|
|
57
|
+
export function sliceStruct(left: Item | GC | Skip, diff: number): Item | GC | Skip;
|
|
58
|
+
export function writeStructToLazyStructWriter(lazyWriter: LazyStructWriter, struct: Item | GC | Skip, offset: number, offsetEnd: number): void;
|
|
59
|
+
export function finishLazyStructWriting(lazyWriter: LazyStructWriter): void;
|
|
62
60
|
export function convertUpdateFormat(update: Uint8Array, blockTransformer: (arg0: Item | GC | Skip) => Item | GC | Skip, YDecoder: typeof UpdateDecoderV2 | typeof UpdateDecoderV1, YEncoder: typeof UpdateEncoderV2 | typeof UpdateEncoderV1): Uint8Array<ArrayBuffer>;
|
|
63
61
|
export function obfuscateUpdate(update: Uint8Array, opts?: ObfuscatorOptions): Uint8Array<ArrayBuffer>;
|
|
64
62
|
export function obfuscateUpdateV2(update: Uint8Array, opts?: ObfuscatorOptions): Uint8Array<ArrayBuffer>;
|
|
65
63
|
export function convertUpdateFormatV1ToV2(update: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
66
64
|
export function convertUpdateFormatV2ToV1(update: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
67
|
-
export function intersectUpdateWithContentIdsV2(update: Uint8Array, contentIds:
|
|
68
|
-
export function intersectUpdateWithContentIds(update: Uint8Array, contentIds:
|
|
69
|
-
export function createDocFromUpdate(update: Uint8Array, opts?: import("./Doc.js").DocOpts): Doc;
|
|
70
|
-
export function createDocFromUpdateV2(update: Uint8Array, opts?: import("./Doc.js").DocOpts): Doc;
|
|
65
|
+
export function intersectUpdateWithContentIdsV2(update: Uint8Array, contentIds: ContentIds, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2, YEncoder?: typeof UpdateEncoderV1 | typeof UpdateEncoderV2): Uint8Array<ArrayBuffer>;
|
|
66
|
+
export function intersectUpdateWithContentIds(update: Uint8Array, contentIds: ContentIds): Uint8Array<ArrayBuffer>;
|
|
71
67
|
export type ObfuscatorOptions = {
|
|
72
68
|
formatting?: boolean | undefined;
|
|
73
69
|
subdocs?: boolean | undefined;
|
|
@@ -76,15 +72,13 @@ export type ObfuscatorOptions = {
|
|
|
76
72
|
*/
|
|
77
73
|
name?: boolean | undefined;
|
|
78
74
|
};
|
|
79
|
-
import { GC } from '../
|
|
80
|
-
import { Item } from '../
|
|
81
|
-
import { Skip } from '../
|
|
82
|
-
import { UpdateDecoderV1 } from '
|
|
83
|
-
import { UpdateDecoderV2 } from '
|
|
84
|
-
import
|
|
85
|
-
import { UpdateEncoderV2 } from '
|
|
86
|
-
import {
|
|
87
|
-
import {
|
|
88
|
-
import { IdSetEncoderV2 } from '../internals.js';
|
|
89
|
-
import { Doc } from '../internals.js';
|
|
75
|
+
import { GC } from '../structs/GC.js';
|
|
76
|
+
import { Item } from '../structs/Item.js';
|
|
77
|
+
import { Skip } from '../structs/Skip.js';
|
|
78
|
+
import { UpdateDecoderV1 } from './UpdateDecoder.js';
|
|
79
|
+
import { UpdateDecoderV2 } from './UpdateDecoder.js';
|
|
80
|
+
import { UpdateEncoderV1 } from './UpdateEncoder.js';
|
|
81
|
+
import { UpdateEncoderV2 } from './UpdateEncoder.js';
|
|
82
|
+
import { IdSetEncoderV1 } from './UpdateEncoder.js';
|
|
83
|
+
import { IdSetEncoderV2 } from './UpdateEncoder.js';
|
|
90
84
|
//# sourceMappingURL=updates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updates.d.ts","sourceRoot":"","sources":["../../../src/utils/updates.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updates.d.ts","sourceRoot":"","sources":["../../../src/utils/updates.js"],"names":[],"mappings":"AA4EA;IACE;;;OAGG;IACH,qBAHW,eAAe,GAAG,eAAe,eACjC,OAAO,EAWjB;IARC,gDAA6C;IAC7C;;OAEG;IACH,MAFU,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,EAAE,CAEjB;IAChB,cAAiB;IACjB,qBAA8B;IAIhC;;OAEG;IACH,QAFY,IAAI,GAAG,EAAE,GAAG,IAAI,GAAE,IAAI,CAQjC;CACF;AAKM,kCAFI,UAAU,QAEkD;AAMhE,oCAHI,UAAU,aACV,OAAO,eAAe,GAAG,OAAO,eAAe,QAYzD;AAKM,qCAFI,UAAU;;;EAE0D;AAOxE,uCAJI,UAAU,aACV,OAAO,eAAe,GAAG,OAAO,eAAe;;;EAczD;AAED;IACE;;OAEG;IACH,qBAFW,eAAe,GAAG,eAAe,EAkB3C;IAfC,mBAAmB;IACnB,mBAAmB;IACnB,gBAAgB;IAChB,2CAAsB;IACtB;;;;;;;;;OASG;IACH,eAFU,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,UAAU,CAAA;KAAE,CAAC,CAEtC;CAE1B;AAQM,sDALI,UAAU,aACV,OAAO,cAAc,GAAG,OAAO,cAAc,aAC7C,OAAO,eAAe,GAAG,OAAO,eAAe,GAC9C,UAAU,CAAC,WAAW,CAAC,CAgDlC;AAMM,oDAHI,UAAU,GACT,UAAU,CAAC,WAAW,CAAC,CAEwF;AAOpH,qDAJI,UAAU,aACV,OAAO,eAAe,GAAG,OAAO,eAAe,GAC9C,UAAU,CA4BrB;AAMM,mDAHI,UAAU,GACT,UAAU,CAEmF;AAUlG,kCAJI,IAAI,GAAG,EAAE,GAAG,IAAI,QAChB,MAAM,GACL,IAAI,GAAG,EAAE,GAAG,IAAI,CAuB3B;AAmBM,0DALI,gBAAgB,UAChB,IAAI,GAAG,EAAE,GAAG,IAAI,UAChB,MAAM,aACN,MAAM,QAgBhB;AAQM,oDAFI,gBAAgB,QA0B1B;AAQM,4CALI,UAAU,oBACV,CAAS,IAAY,EAAZ,IAAI,GAAC,EAAE,GAAC,IAAI,KAAE,IAAI,GAAC,EAAE,GAAC,IAAI,YACnC,OAAO,eAAe,GAAG,OAAO,eAAe,YAC/C,OAAO,eAAe,GAAG,OAAO,eAAe,2BAczD;AAgHM,wCAHI,UAAU,SACV,iBAAiB,2BAE0G;AAM/H,0CAHI,UAAU,SACV,iBAAiB,2BAE4G;AAKjI,kDAFI,UAAU,2BAEiG;AAK/G,kDAFI,UAAU,2BAEiG;AAkB/G,wDANI,UAAU,cACV,UAAU,aACV,OAAO,eAAe,GAAG,OAAO,eAAe,aAC/C,OAAO,eAAe,GAAG,OAAO,eAAe,GAC9C,UAAU,CAAC,WAAW,CAAC,CAqClC;AASM,sDAJI,UAAU,cACV,UAAU,GACT,UAAU,CAAC,WAAW,CAAC,CAGoD;;;;;;;;;mBAjjBpE,kBAAkB;qBAY9B,oBAAoB;qBAIN,oBAAoB;gCAjBQ,oBAAoB;gCAApB,oBAAoB;gCADY,oBAAoB;gCAApB,oBAAoB;+BAApB,oBAAoB;+BAApB,oBAAoB"}
|