@dxos/react-ui-editor 0.3.11-main.6d5715f → 0.3.11-main.870164f
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/dist/lib/browser/index.mjs +961 -1406
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/TextEditor/codemirror.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/comments.d.ts.map +1 -1
- package/dist/types/src/extensions/index.d.ts +0 -3
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/extensions/util.d.ts.map +1 -0
- package/dist/types/src/{components/TextEditor → hooks/automerge}/automerge.stories.d.ts +1 -6
- package/dist/types/src/hooks/automerge/automerge.stories.d.ts.map +1 -0
- package/dist/types/src/hooks/automerge/handle.d.ts +9 -0
- package/dist/types/src/hooks/automerge/handle.d.ts.map +1 -0
- package/dist/types/src/hooks/automerge/index.d.ts +3 -0
- package/dist/types/src/hooks/automerge/index.d.ts.map +1 -0
- package/dist/types/src/hooks/automerge/plugin.d.ts +26 -0
- package/dist/types/src/hooks/automerge/plugin.d.ts.map +1 -0
- package/dist/types/src/{extensions → hooks}/automerge/semaphore.d.ts +4 -4
- package/dist/types/src/hooks/automerge/semaphore.d.ts.map +1 -0
- package/dist/types/src/hooks/automerge/update-automerge.d.ts +6 -0
- package/dist/types/src/hooks/automerge/update-automerge.d.ts.map +1 -0
- package/dist/types/src/hooks/automerge/update-codemirror.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +0 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useTextModel.d.ts +7 -8
- package/dist/types/src/hooks/useTextModel.d.ts.map +1 -1
- package/dist/types/src/hooks/yjs/cursors.d.ts.map +1 -0
- package/dist/types/src/hooks/yjs/index.d.ts +3 -0
- package/dist/types/src/hooks/yjs/index.d.ts.map +1 -0
- package/dist/types/src/hooks/{yjs.d.ts → yjs/space-provider.d.ts} +8 -8
- package/dist/types/src/hooks/yjs/space-provider.d.ts.map +1 -0
- package/dist/types/src/{components/TextEditor → hooks/yjs}/yjs.stories.d.ts +1 -1
- package/dist/types/src/hooks/yjs/yjs.stories.d.ts.map +1 -0
- package/dist/types/src/hooks/yjs/yjs.test.d.ts.map +1 -0
- package/dist/types/src/styles/index.d.ts +0 -1
- package/dist/types/src/styles/index.d.ts.map +1 -1
- package/dist/types/src/testing/replicator.d.ts +2 -2
- package/dist/types/src/testing/replicator.d.ts.map +1 -1
- package/package.json +21 -22
- package/src/components/TextEditor/TextEditor.tsx +1 -1
- package/src/components/TextEditor/codemirror.stories.ts +2 -3
- package/src/extensions/comments.ts +11 -27
- package/src/extensions/index.ts +0 -3
- package/src/{components/TextEditor → hooks/automerge}/automerge.stories.tsx +6 -66
- package/src/hooks/automerge/handle.ts +14 -0
- package/src/hooks/automerge/index.ts +6 -0
- package/src/{extensions/automerge/automerge.ts → hooks/automerge/plugin.ts} +58 -20
- package/src/{extensions → hooks}/automerge/semaphore.ts +12 -14
- package/src/{extensions → hooks}/automerge/update-automerge.ts +6 -5
- package/src/{extensions → hooks}/automerge/update-codemirror.ts +5 -13
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useTextModel.ts +93 -19
- package/src/hooks/yjs/index.ts +6 -0
- package/src/hooks/{yjs.ts → yjs/space-provider.ts} +19 -71
- package/src/{components/TextEditor → hooks/yjs}/yjs.stories.tsx +1 -1
- package/src/{extensions → hooks}/yjs/yjs.test.ts +25 -1
- package/src/styles/index.ts +0 -1
- package/src/testing/replicator.ts +15 -10
- package/dist/types/src/components/TextEditor/automerge.stories.d.ts.map +0 -1
- package/dist/types/src/components/TextEditor/yjs.stories.d.ts.map +0 -1
- package/dist/types/src/extensions/automerge/automerge.d.ts +0 -9
- package/dist/types/src/extensions/automerge/automerge.d.ts.map +0 -1
- package/dist/types/src/extensions/automerge/cursor.d.ts +0 -5
- package/dist/types/src/extensions/automerge/cursor.d.ts.map +0 -1
- package/dist/types/src/extensions/automerge/defs.d.ts +0 -26
- package/dist/types/src/extensions/automerge/defs.d.ts.map +0 -1
- package/dist/types/src/extensions/automerge/index.d.ts +0 -3
- package/dist/types/src/extensions/automerge/index.d.ts.map +0 -1
- package/dist/types/src/extensions/automerge/semaphore.d.ts.map +0 -1
- package/dist/types/src/extensions/automerge/update-automerge.d.ts +0 -5
- package/dist/types/src/extensions/automerge/update-automerge.d.ts.map +0 -1
- package/dist/types/src/extensions/automerge/update-codemirror.d.ts.map +0 -1
- package/dist/types/src/extensions/awareness.d.ts +0 -46
- package/dist/types/src/extensions/awareness.d.ts.map +0 -1
- package/dist/types/src/extensions/yjs/cursor.d.ts +0 -4
- package/dist/types/src/extensions/yjs/cursor.d.ts.map +0 -1
- package/dist/types/src/extensions/yjs/index.d.ts +0 -2
- package/dist/types/src/extensions/yjs/index.d.ts.map +0 -1
- package/dist/types/src/extensions/yjs/yjs.d.ts +0 -4
- package/dist/types/src/extensions/yjs/yjs.d.ts.map +0 -1
- package/dist/types/src/extensions/yjs/yjs.test.d.ts.map +0 -1
- package/dist/types/src/hooks/automerge.d.ts +0 -3
- package/dist/types/src/hooks/automerge.d.ts.map +0 -1
- package/dist/types/src/hooks/awareness-provider.d.ts +0 -28
- package/dist/types/src/hooks/awareness-provider.d.ts.map +0 -1
- package/dist/types/src/hooks/yjs.d.ts.map +0 -1
- package/dist/types/src/styles/cursors.d.ts.map +0 -1
- package/dist/types/src/util/cursor.d.ts +0 -17
- package/dist/types/src/util/cursor.d.ts.map +0 -1
- package/dist/types/src/util/index.d.ts +0 -3
- package/dist/types/src/util/index.d.ts.map +0 -1
- package/dist/types/src/util/util.d.ts.map +0 -1
- package/src/extensions/automerge/cursor.ts +0 -51
- package/src/extensions/automerge/defs.ts +0 -62
- package/src/extensions/automerge/index.ts +0 -6
- package/src/extensions/awareness.ts +0 -316
- package/src/extensions/yjs/cursor.ts +0 -21
- package/src/extensions/yjs/index.ts +0 -5
- package/src/extensions/yjs/yjs.ts +0 -16
- package/src/hooks/automerge.ts +0 -52
- package/src/hooks/awareness-provider.ts +0 -120
- package/src/util/cursor.ts +0 -29
- package/src/util/index.ts +0 -6
- /package/dist/types/src/{util → extensions}/util.d.ts +0 -0
- /package/dist/types/src/{extensions → hooks}/automerge/update-codemirror.d.ts +0 -0
- /package/dist/types/src/{styles → hooks/yjs}/cursors.d.ts +0 -0
- /package/dist/types/src/{extensions → hooks}/yjs/yjs.test.d.ts +0 -0
- /package/src/{util → extensions}/util.ts +0 -0
- /package/src/{styles → hooks/yjs}/cursors.ts +0 -0
|
@@ -2,22 +2,36 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Extension, StateField } from '@codemirror/state';
|
|
6
|
+
import get from 'lodash.get';
|
|
6
7
|
import { useEffect, useState } from 'react';
|
|
7
|
-
import
|
|
8
|
+
import { yCollab } from 'y-codemirror.next';
|
|
9
|
+
import type * as awarenessProtocol from 'y-protocols/awareness';
|
|
10
|
+
import * as Y from 'yjs';
|
|
8
11
|
|
|
9
|
-
import {
|
|
12
|
+
import { invariant } from '@dxos/invariant';
|
|
13
|
+
import {
|
|
14
|
+
type DocAccessor,
|
|
15
|
+
type Space,
|
|
16
|
+
type TextObject,
|
|
17
|
+
type AutomergeTextCompat,
|
|
18
|
+
getRawDoc,
|
|
19
|
+
isActualAutomergeObject,
|
|
20
|
+
} from '@dxos/react-client/echo';
|
|
10
21
|
import { type Identity } from '@dxos/react-client/halo';
|
|
11
22
|
import type { YText, YXmlFragment } from '@dxos/text-model';
|
|
23
|
+
import { arrayToString, stringToArray } from '@dxos/util';
|
|
12
24
|
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
25
|
+
import { automergePlugin } from './automerge';
|
|
26
|
+
import { SpaceAwarenessProvider } from './yjs';
|
|
15
27
|
|
|
16
|
-
// TODO(burdon):
|
|
28
|
+
// TODO(burdon): Move.
|
|
29
|
+
type Awareness = awarenessProtocol.Awareness;
|
|
17
30
|
|
|
18
31
|
/**
|
|
19
32
|
* State field makes the model available to other extensions.
|
|
20
33
|
*/
|
|
34
|
+
// TODO(burdon): Use facet?
|
|
21
35
|
export const modelState = StateField.define<EditorModel | undefined>({
|
|
22
36
|
create: () => undefined,
|
|
23
37
|
update: (model) => model,
|
|
@@ -30,25 +44,20 @@ export type Range = {
|
|
|
30
44
|
|
|
31
45
|
export type CommentRange = {
|
|
32
46
|
id: string;
|
|
47
|
+
// TODO(burdon): Split into begin/end?
|
|
33
48
|
cursor: string;
|
|
34
49
|
};
|
|
35
50
|
|
|
36
51
|
// TODO(wittjosiah): Factor out to common package? @dxos/react-client?
|
|
37
52
|
export type EditorModel = {
|
|
38
53
|
id: string;
|
|
39
|
-
text: () => string;
|
|
40
|
-
extension?: Extension;
|
|
41
|
-
|
|
42
54
|
// TODO(burdon): Remove.
|
|
43
55
|
content: string | YText | YXmlFragment | DocAccessor;
|
|
44
|
-
|
|
45
|
-
* @deprecated Use CursorConverter.
|
|
46
|
-
*/
|
|
56
|
+
text: () => string;
|
|
47
57
|
getCursorFromRange?: (value: Range) => string;
|
|
48
58
|
getRangeFromCursor?: (cursor: string) => Range | undefined;
|
|
49
|
-
|
|
50
|
-
awareness?:
|
|
51
|
-
// TODO(burdon): Remove.
|
|
59
|
+
extension?: Extension;
|
|
60
|
+
awareness?: Awareness;
|
|
52
61
|
peer?: {
|
|
53
62
|
id: string;
|
|
54
63
|
name?: string;
|
|
@@ -73,11 +82,76 @@ export const useTextModel = (props: UseTextModelProps): EditorModel | undefined
|
|
|
73
82
|
|
|
74
83
|
const createModel = (props: UseTextModelProps) => {
|
|
75
84
|
const { text } = props;
|
|
76
|
-
if (
|
|
85
|
+
if (isActualAutomergeObject(text)) {
|
|
77
86
|
return createAutomergeModel(props);
|
|
78
|
-
} else if (text?.doc) {
|
|
79
|
-
return createYjsModel(props);
|
|
80
87
|
} else {
|
|
81
|
-
|
|
88
|
+
if (!text?.doc) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return createYjsModel(props);
|
|
82
93
|
}
|
|
83
94
|
};
|
|
95
|
+
|
|
96
|
+
const createYjsModel = ({ identity, space, text }: UseTextModelProps): EditorModel => {
|
|
97
|
+
invariant(text?.doc && text?.content);
|
|
98
|
+
const provider = space
|
|
99
|
+
? new SpaceAwarenessProvider({ space, doc: text.doc, channel: `yjs.awareness.${text.id}` })
|
|
100
|
+
: undefined;
|
|
101
|
+
|
|
102
|
+
const model: EditorModel = {
|
|
103
|
+
id: text.doc.guid,
|
|
104
|
+
content: text.content,
|
|
105
|
+
text: () => text.content!.toString(),
|
|
106
|
+
// https://github.com/yjs/yjs?tab=readme-ov-file#relative-positions
|
|
107
|
+
getCursorFromRange: (range: Range) => {
|
|
108
|
+
const from = Y.encodeRelativePosition(Y.createRelativePositionFromTypeIndex(text.content as YText, range.from));
|
|
109
|
+
const to = Y.encodeRelativePosition(Y.createRelativePositionFromTypeIndex(text.content as YText, range.to, -1));
|
|
110
|
+
return [arrayToString(from), arrayToString(to)].join(':');
|
|
111
|
+
},
|
|
112
|
+
getRangeFromCursor: (cursor: string) => {
|
|
113
|
+
invariant(text.doc);
|
|
114
|
+
const parts = cursor.split(':');
|
|
115
|
+
const from = Y.createAbsolutePositionFromRelativePosition(
|
|
116
|
+
Y.decodeRelativePosition(stringToArray(parts[0])),
|
|
117
|
+
text.doc,
|
|
118
|
+
);
|
|
119
|
+
const to = Y.createAbsolutePositionFromRelativePosition(
|
|
120
|
+
Y.decodeRelativePosition(stringToArray(parts[1])),
|
|
121
|
+
text.doc,
|
|
122
|
+
);
|
|
123
|
+
return from && to ? { from: from.index, to: to.index } : undefined;
|
|
124
|
+
},
|
|
125
|
+
extension: [yCollab(text.content as YText, provider?.awareness), modelState.init(() => model)],
|
|
126
|
+
awareness: provider?.awareness,
|
|
127
|
+
peer: identity
|
|
128
|
+
? {
|
|
129
|
+
id: identity.identityKey.toHex(),
|
|
130
|
+
name: identity.profile?.displayName,
|
|
131
|
+
}
|
|
132
|
+
: undefined,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
return model;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const createAutomergeModel = ({ identity, text }: UseTextModelProps): EditorModel => {
|
|
139
|
+
const obj = text as any as AutomergeTextCompat;
|
|
140
|
+
const doc = getRawDoc(obj, [obj.field]);
|
|
141
|
+
|
|
142
|
+
const model: EditorModel = {
|
|
143
|
+
id: obj.id,
|
|
144
|
+
content: doc,
|
|
145
|
+
text: () => get(doc.handle.docSync(), doc.path),
|
|
146
|
+
// TODO(burdon): https://automerge.org/automerge/api-docs/js/functions/next.getCursor.html
|
|
147
|
+
extension: [automergePlugin(doc.handle, doc.path), modelState.init(() => model)],
|
|
148
|
+
peer: identity
|
|
149
|
+
? {
|
|
150
|
+
id: identity.identityKey.toHex(),
|
|
151
|
+
name: identity.profile?.displayName,
|
|
152
|
+
}
|
|
153
|
+
: undefined,
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return model;
|
|
157
|
+
};
|
|
@@ -5,62 +5,14 @@
|
|
|
5
5
|
import * as decoding from 'lib0/decoding';
|
|
6
6
|
import * as encoding from 'lib0/encoding';
|
|
7
7
|
import { Observable } from 'lib0/observable';
|
|
8
|
-
import * as
|
|
9
|
-
import * as Y from 'yjs';
|
|
8
|
+
import * as awarenessProtocol from 'y-protocols/awareness';
|
|
10
9
|
import { type Doc } from 'yjs';
|
|
11
10
|
|
|
12
|
-
import { invariant } from '@dxos/invariant';
|
|
13
11
|
import { log } from '@dxos/log';
|
|
14
12
|
import { type Space } from '@dxos/react-client/echo';
|
|
15
13
|
import { type GossipMessage } from '@dxos/react-client/mesh';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import { type EditorModel, modelState, type Range, type UseTextModelProps } from './useTextModel';
|
|
20
|
-
import { yjs } from '../extensions';
|
|
21
|
-
|
|
22
|
-
export const createYjsModel = ({ identity, space, text }: UseTextModelProps): EditorModel => {
|
|
23
|
-
invariant(text?.doc && text?.content);
|
|
24
|
-
const provider = space
|
|
25
|
-
? new YAwarenessProvider({ space, doc: text.doc, channel: `yjs.awareness.${text.id}` })
|
|
26
|
-
: undefined;
|
|
27
|
-
|
|
28
|
-
const model: EditorModel = {
|
|
29
|
-
id: text.doc.guid,
|
|
30
|
-
content: text.content,
|
|
31
|
-
text: () => text.content!.toString(),
|
|
32
|
-
// https://github.com/yjs/yjs?tab=readme-ov-file#relative-positions
|
|
33
|
-
// TODO(dmaretskyi): Refactor as cursor-converter.
|
|
34
|
-
getCursorFromRange: (range: Range) => {
|
|
35
|
-
const from = Y.encodeRelativePosition(Y.createRelativePositionFromTypeIndex(text.content as YText, range.from));
|
|
36
|
-
const to = Y.encodeRelativePosition(Y.createRelativePositionFromTypeIndex(text.content as YText, range.to, -1));
|
|
37
|
-
return [arrayToString(from), arrayToString(to)].join(':');
|
|
38
|
-
},
|
|
39
|
-
getRangeFromCursor: (cursor: string) => {
|
|
40
|
-
invariant(text.doc);
|
|
41
|
-
const parts = cursor.split(':');
|
|
42
|
-
const from = Y.createAbsolutePositionFromRelativePosition(
|
|
43
|
-
Y.decodeRelativePosition(stringToArray(parts[0])),
|
|
44
|
-
text.doc,
|
|
45
|
-
);
|
|
46
|
-
const to = Y.createAbsolutePositionFromRelativePosition(
|
|
47
|
-
Y.decodeRelativePosition(stringToArray(parts[1])),
|
|
48
|
-
text.doc,
|
|
49
|
-
);
|
|
50
|
-
return from && to ? { from: from.index, to: to.index } : undefined;
|
|
51
|
-
},
|
|
52
|
-
extension: [modelState.init(() => model), yjs(text.content as YText, provider?.awareness)],
|
|
53
|
-
awareness: provider?.awareness,
|
|
54
|
-
peer: identity
|
|
55
|
-
? {
|
|
56
|
-
id: identity.identityKey.toHex(),
|
|
57
|
-
name: identity.profile?.displayName,
|
|
58
|
-
}
|
|
59
|
-
: undefined,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
return model;
|
|
63
|
-
};
|
|
14
|
+
|
|
15
|
+
type Awareness = awarenessProtocol.Awareness;
|
|
64
16
|
|
|
65
17
|
// Based on https://github.com/yjs/y-webrtc/blob/88baab2/src/y-webrtc.js.
|
|
66
18
|
|
|
@@ -70,26 +22,16 @@ const messageQueryAwareness = 3;
|
|
|
70
22
|
/**
|
|
71
23
|
* Yjs awareness provider on top of a DXOS space.
|
|
72
24
|
*/
|
|
73
|
-
export class
|
|
25
|
+
export class SpaceAwarenessProvider extends Observable<any> {
|
|
74
26
|
private readonly _space: Space;
|
|
75
|
-
private readonly _awareness:
|
|
27
|
+
private readonly _awareness: Awareness;
|
|
76
28
|
private readonly _clientId: number;
|
|
77
29
|
private readonly _channel: string;
|
|
78
30
|
|
|
79
|
-
constructor({
|
|
80
|
-
space,
|
|
81
|
-
doc,
|
|
82
|
-
channel,
|
|
83
|
-
awareness,
|
|
84
|
-
}: {
|
|
85
|
-
space: Space;
|
|
86
|
-
doc: Doc;
|
|
87
|
-
channel: string;
|
|
88
|
-
awareness?: YP.Awareness;
|
|
89
|
-
}) {
|
|
31
|
+
constructor({ space, doc, channel, awareness }: { space: Space; doc: Doc; channel: string; awareness?: Awareness }) {
|
|
90
32
|
super();
|
|
91
33
|
this._space = space;
|
|
92
|
-
this._awareness = awareness ?? new
|
|
34
|
+
this._awareness = awareness ?? new awarenessProtocol.Awareness(doc);
|
|
93
35
|
this._channel = channel;
|
|
94
36
|
this._clientId = doc.clientID;
|
|
95
37
|
|
|
@@ -110,11 +52,14 @@ export class YAwarenessProvider extends Observable<any> {
|
|
|
110
52
|
// Post local awareness state.
|
|
111
53
|
const encoderAwarenessState = encoding.createEncoder();
|
|
112
54
|
encoding.writeVarUint(encoderAwarenessState, messageAwareness);
|
|
113
|
-
encoding.writeVarUint8Array(
|
|
55
|
+
encoding.writeVarUint8Array(
|
|
56
|
+
encoderAwarenessState,
|
|
57
|
+
awarenessProtocol.encodeAwarenessUpdate(this.awareness, [this._clientId]),
|
|
58
|
+
);
|
|
114
59
|
void this._space.postMessage(this._channel, encoding.toUint8Array(encoderAwarenessState));
|
|
115
60
|
}
|
|
116
61
|
|
|
117
|
-
get awareness():
|
|
62
|
+
get awareness(): Awareness {
|
|
118
63
|
return this._awareness;
|
|
119
64
|
}
|
|
120
65
|
|
|
@@ -123,7 +68,10 @@ export class YAwarenessProvider extends Observable<any> {
|
|
|
123
68
|
const changedClients = added.concat(updated).concat(removed);
|
|
124
69
|
const encoderAwareness = encoding.createEncoder();
|
|
125
70
|
encoding.writeVarUint(encoderAwareness, messageAwareness);
|
|
126
|
-
encoding.writeVarUint8Array(
|
|
71
|
+
encoding.writeVarUint8Array(
|
|
72
|
+
encoderAwareness,
|
|
73
|
+
awarenessProtocol.encodeAwarenessUpdate(this._awareness, changedClients),
|
|
74
|
+
);
|
|
127
75
|
void this._space.postMessage(this._channel, encoding.toUint8Array(encoderAwareness));
|
|
128
76
|
}
|
|
129
77
|
|
|
@@ -144,7 +92,7 @@ export class YAwarenessProvider extends Observable<any> {
|
|
|
144
92
|
let sendReply = false;
|
|
145
93
|
switch (messageType) {
|
|
146
94
|
case messageAwareness: {
|
|
147
|
-
|
|
95
|
+
awarenessProtocol.applyAwarenessUpdate(this._awareness, decoding.readVarUint8Array(decoder), this);
|
|
148
96
|
break;
|
|
149
97
|
}
|
|
150
98
|
|
|
@@ -152,7 +100,7 @@ export class YAwarenessProvider extends Observable<any> {
|
|
|
152
100
|
encoding.writeVarUint(encoder, messageAwareness);
|
|
153
101
|
encoding.writeVarUint8Array(
|
|
154
102
|
encoder,
|
|
155
|
-
|
|
103
|
+
awarenessProtocol.encodeAwarenessUpdate(this._awareness, Array.from(this._awareness.getStates().keys())),
|
|
156
104
|
);
|
|
157
105
|
sendReply = true;
|
|
158
106
|
break;
|
|
@@ -173,6 +121,6 @@ export class YAwarenessProvider extends Observable<any> {
|
|
|
173
121
|
}
|
|
174
122
|
|
|
175
123
|
private _handleBeforeUnload() {
|
|
176
|
-
|
|
124
|
+
awarenessProtocol.removeAwarenessStates(this._awareness, [this._clientId], 'window unload');
|
|
177
125
|
}
|
|
178
126
|
}
|
|
@@ -12,7 +12,7 @@ import { ClientRepeater, textGenerator, useDataGenerator } from '@dxos/react-cli
|
|
|
12
12
|
import { useId, Input } from '@dxos/react-ui';
|
|
13
13
|
import { withTheme } from '@dxos/storybook-utils';
|
|
14
14
|
|
|
15
|
-
import { MarkdownEditor } from '
|
|
15
|
+
import { MarkdownEditor } from '../../components';
|
|
16
16
|
import { Replicator, useYjsModel } from '../../testing';
|
|
17
17
|
|
|
18
18
|
export default {
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { effect } from '@preact/signals-react';
|
|
5
6
|
import { expect } from 'chai';
|
|
6
7
|
import * as Y from 'yjs';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
+
import { Trigger } from '@dxos/async';
|
|
10
|
+
import { Expando, setGlobalAutomergePreference, TextObject } from '@dxos/echo-schema';
|
|
11
|
+
import { registerSignalFactory } from '@dxos/echo-signals';
|
|
9
12
|
import { describe, test } from '@dxos/test';
|
|
10
13
|
import { type YText } from '@dxos/text-model';
|
|
11
14
|
|
|
@@ -32,4 +35,25 @@ describe('YJS', () => {
|
|
|
32
35
|
expect(obj.text.substring(cursor!.index)).to.equal('world');
|
|
33
36
|
}
|
|
34
37
|
});
|
|
38
|
+
|
|
39
|
+
// TODO(burdon): Test deleting end character.
|
|
40
|
+
|
|
41
|
+
test.skip('effect', async () => {
|
|
42
|
+
setGlobalAutomergePreference(true);
|
|
43
|
+
registerSignalFactory();
|
|
44
|
+
const obj = new Expando({ comments: [] });
|
|
45
|
+
|
|
46
|
+
const trigger = new Trigger();
|
|
47
|
+
const unsubscribe = effect(() => {
|
|
48
|
+
// TODO(burdon): BUG: doesn't work with YJS.
|
|
49
|
+
console.log(obj.comments);
|
|
50
|
+
if (obj.comments.length > 0) {
|
|
51
|
+
trigger.wake();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
obj.comments.push({ message: 'hello' });
|
|
56
|
+
await trigger.wait();
|
|
57
|
+
unsubscribe();
|
|
58
|
+
});
|
|
35
59
|
});
|
package/src/styles/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as decoding from 'lib0/decoding';
|
|
|
7
7
|
import * as encoding from 'lib0/encoding';
|
|
8
8
|
import { Observable } from 'lib0/observable';
|
|
9
9
|
import { useMemo } from 'react';
|
|
10
|
-
import * as
|
|
10
|
+
import * as awarenessProtocol from 'y-protocols/awareness';
|
|
11
11
|
import * as syncProtocol from 'y-protocols/sync';
|
|
12
12
|
import { Doc } from 'yjs';
|
|
13
13
|
|
|
@@ -15,10 +15,9 @@ import { Event } from '@dxos/async';
|
|
|
15
15
|
import { log } from '@dxos/log';
|
|
16
16
|
import { TextKind } from '@dxos/protocols/proto/dxos/echo/model/text';
|
|
17
17
|
|
|
18
|
-
import { type EditorModel } from '../hooks';
|
|
19
|
-
import { cursorColor } from '../styles';
|
|
18
|
+
import { cursorColor, type EditorModel } from '../hooks';
|
|
20
19
|
|
|
21
|
-
type Awareness =
|
|
20
|
+
type Awareness = awarenessProtocol.Awareness;
|
|
22
21
|
|
|
23
22
|
const messageSync = 0;
|
|
24
23
|
const messageAwareness = 1;
|
|
@@ -36,7 +35,7 @@ export class AwarenessProvider extends Observable<any> {
|
|
|
36
35
|
super();
|
|
37
36
|
this._remoteUpdate = update;
|
|
38
37
|
this._doc = doc;
|
|
39
|
-
this._awareness = awareness ?? new
|
|
38
|
+
this._awareness = awareness ?? new awarenessProtocol.Awareness(doc);
|
|
40
39
|
|
|
41
40
|
this._doc.on('update', this._handleDocUpdate.bind(this));
|
|
42
41
|
this._awareness.on('update', this._handleAwarenessUpdate.bind(this));
|
|
@@ -56,7 +55,10 @@ export class AwarenessProvider extends Observable<any> {
|
|
|
56
55
|
// Post local awareness state.
|
|
57
56
|
const encoderAwarenessState = encoding.createEncoder();
|
|
58
57
|
encoding.writeVarUint(encoderAwarenessState, messageAwareness);
|
|
59
|
-
encoding.writeVarUint8Array(
|
|
58
|
+
encoding.writeVarUint8Array(
|
|
59
|
+
encoderAwarenessState,
|
|
60
|
+
awarenessProtocol.encodeAwarenessUpdate(this.awareness, [this._doc.clientID]),
|
|
61
|
+
);
|
|
60
62
|
void this._remoteUpdate.emit(encoding.toUint8Array(encoderAwarenessState));
|
|
61
63
|
}
|
|
62
64
|
|
|
@@ -77,7 +79,10 @@ export class AwarenessProvider extends Observable<any> {
|
|
|
77
79
|
const changedClients = added.concat(updated).concat(removed);
|
|
78
80
|
const encoderAwareness = encoding.createEncoder();
|
|
79
81
|
encoding.writeVarUint(encoderAwareness, messageAwareness);
|
|
80
|
-
encoding.writeVarUint8Array(
|
|
82
|
+
encoding.writeVarUint8Array(
|
|
83
|
+
encoderAwareness,
|
|
84
|
+
awarenessProtocol.encodeAwarenessUpdate(this._awareness, changedClients),
|
|
85
|
+
);
|
|
81
86
|
this._remoteUpdate.emit(encoding.toUint8Array(encoderAwareness));
|
|
82
87
|
}
|
|
83
88
|
|
|
@@ -104,7 +109,7 @@ export class AwarenessProvider extends Observable<any> {
|
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
case messageAwareness: {
|
|
107
|
-
|
|
112
|
+
awarenessProtocol.applyAwarenessUpdate(this._awareness, decoding.readVarUint8Array(decoder), this);
|
|
108
113
|
break;
|
|
109
114
|
}
|
|
110
115
|
|
|
@@ -112,7 +117,7 @@ export class AwarenessProvider extends Observable<any> {
|
|
|
112
117
|
encoding.writeVarUint(encoder, messageAwareness);
|
|
113
118
|
encoding.writeVarUint8Array(
|
|
114
119
|
encoder,
|
|
115
|
-
|
|
120
|
+
awarenessProtocol.encodeAwarenessUpdate(this._awareness, Array.from(this._awareness.getStates().keys())),
|
|
116
121
|
);
|
|
117
122
|
sendReply = true;
|
|
118
123
|
break;
|
|
@@ -133,7 +138,7 @@ export class AwarenessProvider extends Observable<any> {
|
|
|
133
138
|
}
|
|
134
139
|
|
|
135
140
|
private _handleBeforeUnload() {
|
|
136
|
-
|
|
141
|
+
awarenessProtocol.removeAwarenessStates(this._awareness, [this._doc.clientID], 'window unload');
|
|
137
142
|
}
|
|
138
143
|
}
|
|
139
144
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"automerge.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/automerge.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAIpB,OAAO,uBAAuB,CAAC;AAK/B,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAUtD,OAAO,EAAE,KAAK,UAAU,EAAwB,MAAM,kBAAkB,CAAC;AAKzE,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,IAAI,EAAE,CAAC;CACd,CAAC;;;;;;AA+DF,wBAIE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC;AA8B1B,eAAO,MAAM,QAAQ;;;CAoBpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"yjs.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/TextEditor/yjs.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAEpB,OAAO,KAAmB,MAAM,OAAO,CAAC;;;;;;AAWxC,wBAIE;AA+BF,eAAO,MAAM,OAAO;;CAGnB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type Extension } from '@codemirror/state';
|
|
2
|
-
import { type Prop } from '@dxos/automerge/automerge';
|
|
3
|
-
import { type IDocHandle } from './defs';
|
|
4
|
-
export type AutomergeOptions = {
|
|
5
|
-
handle: IDocHandle;
|
|
6
|
-
path: Prop[];
|
|
7
|
-
};
|
|
8
|
-
export declare const automerge: ({ handle, path }: AutomergeOptions) => Extension;
|
|
9
|
-
//# sourceMappingURL=automerge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"automerge.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/automerge/automerge.ts"],"names":[],"mappings":"AAMA,OAAO,EAAqB,KAAK,SAAS,EAAoB,MAAM,mBAAmB,CAAC;AAIxF,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAGtD,OAAO,EAAc,KAAK,UAAU,EAA6B,MAAM,QAAQ,CAAC;AAQhF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,IAAI,EAAE,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,SAAS,qBAAsB,gBAAgB,KAAG,SAmE9D,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Prop } from '@dxos/automerge/automerge';
|
|
2
|
-
import { type IDocHandle } from './defs';
|
|
3
|
-
import { type CursorConverter } from '../../util';
|
|
4
|
-
export declare const cursorConverter: (handle: IDocHandle, path: Prop[]) => CursorConverter;
|
|
5
|
-
//# sourceMappingURL=cursor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/automerge/cursor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAGtD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,eAAO,MAAM,eAAe,WAAY,UAAU,QAAQ,IAAI,EAAE,KAAG,eAsCjE,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { StateEffect, type StateField, type EditorState, type Transaction, type TransactionSpec } from '@codemirror/state';
|
|
2
|
-
import { type ChangeFn, type ChangeOptions, type Doc, type Heads, type Prop } from '@dxos/automerge/automerge';
|
|
3
|
-
export type Value = {
|
|
4
|
-
lastHeads: Heads;
|
|
5
|
-
path: Prop[];
|
|
6
|
-
unreconciledTransactions: Transaction[];
|
|
7
|
-
};
|
|
8
|
-
type UpdateHeads = {
|
|
9
|
-
newHeads: Heads;
|
|
10
|
-
};
|
|
11
|
-
export declare const effectType: import("@codemirror/state").StateEffectType<UpdateHeads>;
|
|
12
|
-
export declare const updateHeads: (newHeads: Heads) => StateEffect<UpdateHeads>;
|
|
13
|
-
export declare const getLastHeads: (state: EditorState, field: StateField<Value>) => Heads;
|
|
14
|
-
export declare const getPath: (state: EditorState, field: StateField<Value>) => Prop[];
|
|
15
|
-
export declare const reconcileAnnotationType: import("@codemirror/state").AnnotationType<unknown>;
|
|
16
|
-
export declare const isReconcileTx: (tr: Transaction) => boolean;
|
|
17
|
-
export declare const makeReconcile: (tr: TransactionSpec) => void;
|
|
18
|
-
export type IDocHandle<T = any> = {
|
|
19
|
-
docSync(): Doc<T> | undefined;
|
|
20
|
-
change(callback: ChangeFn<T>, options?: ChangeOptions<T>): void;
|
|
21
|
-
changeAt(heads: Heads, callback: ChangeFn<T>, options?: ChangeOptions<T>): string[] | undefined;
|
|
22
|
-
addListener(event: 'change', listener: () => void): void;
|
|
23
|
-
removeListener(event: 'change', listener: () => void): void;
|
|
24
|
-
};
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=defs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/automerge/defs.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,WAAW,EACX,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,GAAG,EAAE,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAE/G,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,wBAAwB,EAAE,WAAW,EAAE,CAAC;CACzC,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,KAAK,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,UAAU,0DAAsC,CAAC;AAE9D,eAAO,MAAM,WAAW,uBAAsB,YAAY,WAAW,CAAgC,CAAC;AAEtG,eAAO,MAAM,YAAY,UAAW,WAAW,SAAS,WAAW,KAAK,CAAC,UAAwC,CAAC;AAElH,eAAO,MAAM,OAAO,UAAW,WAAW,SAAS,WAAW,KAAK,CAAC,KAAG,IAAI,EAA6B,CAAC;AAEzG,eAAO,MAAM,uBAAuB,qDAA+B,CAAC;AAEpE,eAAO,MAAM,aAAa,OAAQ,WAAW,KAAG,OAAmD,CAAC;AAEpG,eAAO,MAAM,aAAa,OAAQ,eAAe,SAchD,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,GAAG,IAAI;IAChC,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC9B,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAChE,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IAEhG,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACzD,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC7D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/automerge/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"semaphore.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/automerge/semaphore.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAML,KAAK,UAAU,EACf,KAAK,KAAK,EACX,MAAM,QAAQ,CAAC;AAIhB,KAAK,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC/B,KAAK,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;AAE7B,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,KAAK,KAAK,GAAG,SAAS,CAAC;AAE3F;;GAEG;AACH,qBAAa,cAAc;IAIb,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHnC,YAAY,UAAS;IACrB,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAM;gBAEA,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC;IAEtD,SAAS,WAAY,UAAU,QAAQ,UAAU,UAyC/C;CACH"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type EditorState, type StateField, type Transaction } from '@codemirror/state';
|
|
2
|
-
import { type Heads } from '@dxos/automerge/automerge';
|
|
3
|
-
import { type IDocHandle, type Value } from './defs';
|
|
4
|
-
export declare const updateAutomerge: (field: StateField<Value>, handle: IDocHandle, transactions: Transaction[], state: EditorState) => Heads | undefined;
|
|
5
|
-
//# sourceMappingURL=update-automerge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-automerge.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/automerge/update-automerge.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAa,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnG,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAErD,eAAO,MAAM,eAAe,UACnB,WAAW,KAAK,CAAC,UAChB,UAAU,gBACJ,WAAW,EAAE,SACpB,WAAW,KACjB,KAAK,GAAG,SAyBV,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-codemirror.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/automerge/update-codemirror.ts"],"names":[],"mappings":"AAMA,OAAO,EAA8B,KAAK,eAAe,EAAoB,MAAM,mBAAmB,CAAC;AACvG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAGL,KAAK,KAAK,EACV,KAAK,IAAI,EAGV,MAAM,2BAA2B,CAAC;AAInC,eAAO,MAAM,gBAAgB,SAAU,UAAU,aAAa,eAAe,UAAU,IAAI,EAAE,WAAW,KAAK,EAAE,SAiB9G,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Facet, type Extension } from '@codemirror/state';
|
|
2
|
-
import { type DecorationSet, EditorView, type PluginValue, type ViewUpdate } from '@codemirror/view';
|
|
3
|
-
import { Event } from '@dxos/async';
|
|
4
|
-
export interface AwarenessProvider {
|
|
5
|
-
remoteStateChange: Event<void>;
|
|
6
|
-
open(): void;
|
|
7
|
-
close(): void;
|
|
8
|
-
update(position: AwarenessPosition | undefined): void;
|
|
9
|
-
getRemoteStates(): AwarenessState[];
|
|
10
|
-
}
|
|
11
|
-
export declare const AwarenessProvider: Facet<AwarenessProvider, AwarenessProvider>;
|
|
12
|
-
export type AwarenessPosition = {
|
|
13
|
-
anchor?: string;
|
|
14
|
-
head?: string;
|
|
15
|
-
};
|
|
16
|
-
export type AwarenessInfo = {
|
|
17
|
-
displayName?: string;
|
|
18
|
-
color?: string;
|
|
19
|
-
lightColor?: string;
|
|
20
|
-
};
|
|
21
|
-
export type AwarenessState = {
|
|
22
|
-
position?: AwarenessPosition;
|
|
23
|
-
peerId: string;
|
|
24
|
-
info: AwarenessInfo;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Extension provides presence information about other peers.
|
|
28
|
-
*/
|
|
29
|
-
export declare const awareness: (provider?: AwarenessProvider) => Extension;
|
|
30
|
-
/**
|
|
31
|
-
* Generates selection decorations from remote peers.
|
|
32
|
-
*/
|
|
33
|
-
export declare class RemoteSelectionsDecorator implements PluginValue {
|
|
34
|
-
decorations: DecorationSet;
|
|
35
|
-
private readonly _ctx;
|
|
36
|
-
private _cursorConverter;
|
|
37
|
-
private _provider;
|
|
38
|
-
private _lastAnchor?;
|
|
39
|
-
private _lastHead?;
|
|
40
|
-
constructor(view: EditorView);
|
|
41
|
-
destroy(): void;
|
|
42
|
-
update(update: ViewUpdate): void;
|
|
43
|
-
private _updateLocalSelection;
|
|
44
|
-
private _updateRemoteSelections;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=awareness.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"awareness.d.ts","sourceRoot":"","sources":["../../../../src/extensions/awareness.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,EAAE,KAAK,SAAS,EAAwB,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAEL,KAAK,aAAa,EAClB,UAAU,EACV,KAAK,WAAW,EAEhB,KAAK,UAAU,EAEhB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKpC,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IAEd,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,GAAG,IAAI,CAAC;IACtD,eAAe,IAAI,cAAc,EAAE,CAAC;CACrC;AAYD,eAAO,MAAM,iBAAiB,6CAE5B,CAAC;AAKH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;CACrB,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,SAAS,oCAA+B,SAQpD,CAAC;AAEF;;GAEG;AACH,qBAAa,yBAA0B,YAAW,WAAW;IACpD,WAAW,EAAE,aAAa,CAAmB;IAEpD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiB;IAEtC,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,WAAW,CAAC,CAAqB;IACzC,OAAO,CAAC,SAAS,CAAC,CAAqB;gBAE3B,IAAI,EAAE,UAAU;IAS5B,OAAO;IAKP,MAAM,CAAC,MAAM,EAAE,UAAU;IAKzB,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,uBAAuB;CA4EhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/yjs/cursor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,eAAO,MAAM,eAAe,SAAU,MAAM,KAAG,eAU7C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/yjs/index.ts"],"names":[],"mappings":"AAIA,cAAc,OAAO,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"yjs.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/yjs/yjs.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAK9C,eAAO,MAAM,GAAG,YAAa,KAAK,cAAc,GAAG,SAAS,4CAG3D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"yjs.test.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/yjs/yjs.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"automerge.d.ts","sourceRoot":"","sources":["../../../../src/hooks/automerge.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,WAAW,EAAc,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAItF,eAAO,MAAM,oBAAoB,8BAA+B,iBAAiB,KAAG,WAqCnF,CAAC"}
|