@y/y 14.0.0-16 → 14.0.0-18

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.
Files changed (68) hide show
  1. package/dist/{index-DyTeTfmj.js → index-BV-j5wdP.js} +2 -2
  2. package/dist/{index-R7GxO-36.js.map → index-BV-j5wdP.js.map} +1 -1
  3. package/dist/{internals.mjs → internals.js} +1 -1
  4. package/dist/internals.js.map +1 -0
  5. package/dist/{testHelper.mjs → testHelper.js} +2 -2
  6. package/dist/testHelper.js.map +1 -0
  7. package/dist/{yjs.mjs → yjs.js} +2 -2
  8. package/dist/yjs.js.map +1 -0
  9. package/package.json +9 -18
  10. package/dist/Skip-j0kX7pdq.js +0 -12173
  11. package/dist/Skip-j0kX7pdq.js.map +0 -1
  12. package/dist/index-DyTeTfmj.js.map +0 -1
  13. package/dist/index-R7GxO-36.js +0 -165
  14. package/dist/internals.cjs +0 -286
  15. package/dist/internals.cjs.map +0 -1
  16. package/dist/internals.mjs.map +0 -1
  17. package/dist/testHelper.cjs +0 -780
  18. package/dist/testHelper.cjs.map +0 -1
  19. package/dist/testHelper.mjs.map +0 -1
  20. package/dist/yjs.cjs +0 -151
  21. package/dist/yjs.cjs.map +0 -1
  22. package/dist/yjs.mjs.map +0 -1
  23. package/src/index.js +0 -153
  24. package/src/internals.js +0 -44
  25. package/src/structs/AbstractStruct.js +0 -59
  26. package/src/structs/ContentAny.js +0 -115
  27. package/src/structs/ContentBinary.js +0 -93
  28. package/src/structs/ContentDeleted.js +0 -101
  29. package/src/structs/ContentDoc.js +0 -141
  30. package/src/structs/ContentEmbed.js +0 -98
  31. package/src/structs/ContentFormat.js +0 -105
  32. package/src/structs/ContentJSON.js +0 -119
  33. package/src/structs/ContentString.js +0 -113
  34. package/src/structs/ContentType.js +0 -176
  35. package/src/structs/GC.js +0 -80
  36. package/src/structs/Item.js +0 -845
  37. package/src/structs/Skip.js +0 -75
  38. package/src/types/AbstractType.js +0 -1434
  39. package/src/types/YArray.js +0 -270
  40. package/src/types/YMap.js +0 -244
  41. package/src/types/YText.js +0 -934
  42. package/src/types/YXmlElement.js +0 -227
  43. package/src/types/YXmlFragment.js +0 -266
  44. package/src/types/YXmlHook.js +0 -68
  45. package/src/types/YXmlText.js +0 -66
  46. package/src/utils/AbstractConnector.js +0 -25
  47. package/src/utils/AttributionManager.js +0 -619
  48. package/src/utils/Doc.js +0 -372
  49. package/src/utils/EventHandler.js +0 -87
  50. package/src/utils/ID.js +0 -89
  51. package/src/utils/IdMap.js +0 -629
  52. package/src/utils/IdSet.js +0 -823
  53. package/src/utils/RelativePosition.js +0 -352
  54. package/src/utils/Snapshot.js +0 -220
  55. package/src/utils/StructSet.js +0 -137
  56. package/src/utils/StructStore.js +0 -289
  57. package/src/utils/Transaction.js +0 -489
  58. package/src/utils/UndoManager.js +0 -391
  59. package/src/utils/UpdateDecoder.js +0 -281
  60. package/src/utils/UpdateEncoder.js +0 -320
  61. package/src/utils/YEvent.js +0 -216
  62. package/src/utils/delta-helpers.js +0 -54
  63. package/src/utils/encoding.js +0 -623
  64. package/src/utils/isParentOf.js +0 -21
  65. package/src/utils/logging.js +0 -21
  66. package/src/utils/types.js +0 -28
  67. package/src/utils/updates.js +0 -715
  68. package/tests/testHelper.js +0 -600
@@ -1,227 +0,0 @@
1
- import * as object from 'lib0/object'
2
-
3
- import {
4
- YXmlFragment,
5
- transact,
6
- typeMapDelete,
7
- typeMapHas,
8
- typeMapSet,
9
- typeMapGet,
10
- typeMapGetAll,
11
- typeMapGetAllSnapshot,
12
- YXmlElementRefID,
13
- Snapshot, YXmlText, ContentType, AbstractType, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Item, // eslint-disable-line
14
- } from '../internals.js'
15
-
16
- /**
17
- * @typedef {Object|number|null|Array<any>|string|Uint8Array|AbstractType<any>} ValueTypes
18
- */
19
-
20
- /**
21
- * An YXmlElement imitates the behavior of a
22
- * https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element
23
- *
24
- * * An YXmlElement has attributes (key value pairs)
25
- * * An YXmlElement has childElements that must inherit from YXmlElement
26
- *
27
- * @template {{ [key: string]: any }} [Attrs={ [key: string]: string }]
28
- * @template {any} [Children=any]
29
- * @extends YXmlFragment<Children,Attrs>
30
- */
31
- export class YXmlElement extends YXmlFragment {
32
- constructor (nodeName = 'UNDEFINED') {
33
- super()
34
- this.nodeName = nodeName
35
- /**
36
- * @type {Map<string, any>|null}
37
- */
38
- this._prelimAttrs = new Map()
39
- }
40
-
41
- /**
42
- * @type {YXmlElement|YXmlText|null}
43
- */
44
- get nextSibling () {
45
- const n = this._item ? this._item.next : null
46
- return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null
47
- }
48
-
49
- /**
50
- * @type {YXmlElement|YXmlText|null}
51
- */
52
- get prevSibling () {
53
- const n = this._item ? this._item.prev : null
54
- return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null
55
- }
56
-
57
- /**
58
- * Integrate this type into the Yjs instance.
59
- *
60
- * * Save this struct in the os
61
- * * This type is sent to other client
62
- * * Observer functions are fired
63
- *
64
- * @param {Doc} y The Yjs instance
65
- * @param {Item?} item
66
- */
67
- _integrate (y, item) {
68
- super._integrate(y, item)
69
- ;(/** @type {Map<string, any>} */ (this._prelimAttrs)).forEach((value, key) => {
70
- this.setAttribute(key, value)
71
- })
72
- this._prelimAttrs = null
73
- }
74
-
75
- /**
76
- * Creates an Item with the same effect as this Item (without position effect)
77
- *
78
- * @return {this}
79
- */
80
- _copy () {
81
- return /** @type {any} */ (new YXmlElement(this.nodeName))
82
- }
83
-
84
- /**
85
- * Makes a copy of this data type that can be included somewhere else.
86
- *
87
- * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.
88
- *
89
- * @return {this}
90
- */
91
- clone () {
92
- const el = this._copy()
93
- const attrs = this.getAttributes()
94
- object.forEach(attrs, (value, key) => {
95
- if (typeof value === 'string') {
96
- el.setAttribute(key, value)
97
- }
98
- })
99
- // @ts-ignore
100
- el.insert(0, this.toArray().map(item => item instanceof AbstractType ? item.clone() : item))
101
- return el
102
- }
103
-
104
- /**
105
- * Returns the XML serialization of this YXmlElement.
106
- * The attributes are ordered by attribute-name, so you can easily use this
107
- * method to compare YXmlElements
108
- *
109
- * @return {string} The string representation of this type.
110
- *
111
- * @public
112
- */
113
- toString () {
114
- const attrs = this.getAttributes()
115
- const stringBuilder = []
116
- const keys = []
117
- for (const key in attrs) {
118
- keys.push(key)
119
- }
120
- keys.sort()
121
- const keysLen = keys.length
122
- for (let i = 0; i < keysLen; i++) {
123
- const key = keys[i]
124
- stringBuilder.push(key + '="' + attrs[key] + '"')
125
- }
126
- const nodeName = this.nodeName.toLocaleLowerCase()
127
- const attrsString = stringBuilder.length > 0 ? ' ' + stringBuilder.join(' ') : ''
128
- return `<${nodeName}${attrsString}>${super.toString()}</${nodeName}>`
129
- }
130
-
131
- /**
132
- * Removes an attribute from this YXmlElement.
133
- *
134
- * @param {string} attributeName The attribute name that is to be removed.
135
- *
136
- * @public
137
- */
138
- removeAttribute (attributeName) {
139
- if (this.doc !== null) {
140
- transact(this.doc, transaction => {
141
- typeMapDelete(transaction, this, attributeName)
142
- })
143
- } else {
144
- /** @type {Map<string,any>} */ (this._prelimAttrs).delete(attributeName)
145
- }
146
- }
147
-
148
- /**
149
- * Sets or updates an attribute.
150
- *
151
- * @template {keyof Attrs & string} KEY
152
- *
153
- * @param {KEY} attributeName The attribute name that is to be set.
154
- * @param {Attrs[KEY]} attributeValue The attribute value that is to be set.
155
- *
156
- * @public
157
- */
158
- setAttribute (attributeName, attributeValue) {
159
- if (this.doc !== null) {
160
- transact(this.doc, transaction => {
161
- typeMapSet(transaction, this, attributeName, /** @type {any} */ (attributeValue))
162
- })
163
- } else {
164
- /** @type {Map<string, any>} */ (this._prelimAttrs).set(attributeName, attributeValue)
165
- }
166
- }
167
-
168
- /**
169
- * Returns an attribute value that belongs to the attribute name.
170
- *
171
- * @template {keyof Attrs & string} KEY
172
- *
173
- * @param {KEY} attributeName The attribute name that identifies the
174
- * queried value.
175
- * @return {Attrs[KEY]|undefined} The queried attribute value.
176
- *
177
- * @public
178
- */
179
- getAttribute (attributeName) {
180
- return /** @type {any} */ (typeMapGet(this, attributeName))
181
- }
182
-
183
- /**
184
- * Returns whether an attribute exists
185
- *
186
- * @param {string} attributeName The attribute name to check for existence.
187
- * @return {boolean} whether the attribute exists.
188
- *
189
- * @public
190
- */
191
- hasAttribute (attributeName) {
192
- return /** @type {any} */ (typeMapHas(this, attributeName))
193
- }
194
-
195
- /**
196
- * Returns all attribute name/value pairs in a JSON Object.
197
- *
198
- * @param {Snapshot} [snapshot]
199
- * @return {{ [Key in Extract<keyof Attrs,string>]?: Attrs[Key]}} A JSON Object that describes the attributes.
200
- *
201
- * @public
202
- */
203
- getAttributes (snapshot) {
204
- return /** @type {any} */ (snapshot ? typeMapGetAllSnapshot(this, snapshot) : typeMapGetAll(this))
205
- }
206
-
207
- /**
208
- * Transform the properties of this type to binary and write it to an
209
- * BinaryEncoder.
210
- *
211
- * This is called when this Item is sent to a remote peer.
212
- *
213
- * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
214
- */
215
- _write (encoder) {
216
- encoder.writeTypeRef(YXmlElementRefID)
217
- encoder.writeKey(this.nodeName)
218
- }
219
- }
220
-
221
- /**
222
- * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
223
- * @return {import('../utils/types.js').YType}
224
- *
225
- * @function
226
- */
227
- export const readYXmlElement = decoder => new YXmlElement(decoder.readKey())
@@ -1,266 +0,0 @@
1
- /**
2
- * @module YXml
3
- */
4
-
5
- import {
6
- AbstractType,
7
- typeListMap,
8
- typeListForEach,
9
- typeListInsertGenerics,
10
- typeListInsertGenericsAfter,
11
- typeListDelete,
12
- typeListToArray,
13
- YXmlFragmentRefID,
14
- transact,
15
- typeListGet,
16
- typeListSlice,
17
- warnPrematureAccess,
18
- YXmlElement, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Transaction, Item, YXmlText, YXmlHook // eslint-disable-line
19
- } from '../internals.js'
20
-
21
- import * as delta from 'lib0/delta' // eslint-disable-line
22
- import * as error from 'lib0/error'
23
-
24
- /**
25
- * Define the elements to which a set of CSS queries apply.
26
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors}
27
- *
28
- * @example
29
- * query = '.classSelector'
30
- * query = 'nodeSelector'
31
- * query = '#idSelector'
32
- *
33
- * @typedef {string} CSS_Selector
34
- */
35
-
36
- /**
37
- * Dom filter function.
38
- *
39
- * @callback domFilter
40
- * @param {string} nodeName The nodeName of the element
41
- * @param {Map} attributes The map of attributes.
42
- * @return {boolean} Whether to include the Dom node in the YXmlElement.
43
- */
44
-
45
- /**
46
- * Represents a list of {@link YXmlElement}.and {@link YXmlText} types.
47
- * A YxmlFragment is similar to a {@link YXmlElement}, but it does not have a
48
- * nodeName and it does not have attributes. Though it can be bound to a DOM
49
- * element - in this case the attributes and the nodeName are not shared.
50
- *
51
- * @public
52
- * @template {any} [Children=any]
53
- * @template {{[K in string]:any}} [Attrs={}]
54
- * @extends AbstractType<delta.Delta<any,Attrs,Children,any>>
55
- */
56
- export class YXmlFragment extends AbstractType {
57
- constructor () {
58
- super()
59
- /**
60
- * @todo remove _prelimContent
61
- * @type {Array<any>|null}
62
- */
63
- this._prelimContent = []
64
- }
65
-
66
- /**
67
- * @type {YXmlElement|YXmlText|null}
68
- */
69
- get firstChild () {
70
- const first = this._first
71
- return first ? first.content.getContent()[0] : null
72
- }
73
-
74
- /**
75
- * Integrate this type into the Yjs instance.
76
- *
77
- * * Save this struct in the os
78
- * * This type is sent to other client
79
- * * Observer functions are fired
80
- *
81
- * @param {Doc} y The Yjs instance
82
- * @param {Item?} item
83
- */
84
- _integrate (y, item) {
85
- super._integrate(y, item)
86
- this.insert(0, /** @type {Array<any>} */ (this._prelimContent))
87
- this._prelimContent = null
88
- }
89
-
90
- /**
91
- * Makes a copy of this data type that can be included somewhere else.
92
- *
93
- * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.
94
- *
95
- * @return {this}
96
- */
97
- clone () {
98
- const el = this._copy()
99
- el.insert(0, this.toArray().map(item => item instanceof AbstractType ? item.clone() : item))
100
- return el
101
- }
102
-
103
- get length () {
104
- this.doc ?? warnPrematureAccess()
105
- return this._prelimContent === null ? this._length : this._prelimContent.length
106
- }
107
-
108
- /**
109
- * Get the string representation of all the children of this YXmlFragment.
110
- *
111
- * @return {string} The string representation of all children.
112
- */
113
- toString () {
114
- return typeListMap(this, xml => xml.toString()).join('')
115
- }
116
-
117
- /**
118
- * @return {string}
119
- */
120
- toJSON () {
121
- return this.toString()
122
- }
123
-
124
- /**
125
- * Inserts new content at an index.
126
- *
127
- * @example
128
- * // Insert character 'a' at position 0
129
- * xml.insert(0, [new Y.XmlText('text')])
130
- *
131
- * @param {number} index The index to insert content at
132
- * @param {Array<YXmlElement|YXmlText|YXmlHook>} content The array of content
133
- */
134
- insert (index, content) {
135
- if (this.doc !== null) {
136
- transact(this.doc, transaction => {
137
- typeListInsertGenerics(transaction, this, index, content)
138
- })
139
- } else {
140
- // @ts-ignore _prelimContent is defined because this is not yet integrated
141
- this._prelimContent.splice(index, 0, ...content)
142
- }
143
- }
144
-
145
- /**
146
- * Inserts new content at an index.
147
- *
148
- * @example
149
- * // Insert character 'a' at position 0
150
- * xml.insert(0, [new Y.XmlText('text')])
151
- *
152
- * @param {null|Item|YXmlElement|YXmlText} ref The index to insert content at
153
- * @param {Array<YXmlElement|YXmlText>} content The array of content
154
- */
155
- insertAfter (ref, content) {
156
- if (this.doc !== null) {
157
- transact(this.doc, transaction => {
158
- const refItem = (ref && ref instanceof AbstractType) ? ref._item : ref
159
- typeListInsertGenericsAfter(transaction, this, refItem, content)
160
- })
161
- } else {
162
- const pc = /** @type {Array<any>} */ (this._prelimContent)
163
- const index = ref === null ? 0 : pc.findIndex(el => el === ref) + 1
164
- if (index === 0 && ref !== null) {
165
- throw error.create('Reference item not found')
166
- }
167
- pc.splice(index, 0, ...content)
168
- }
169
- }
170
-
171
- /**
172
- * Deletes elements starting from an index.
173
- *
174
- * @param {number} index Index at which to start deleting elements
175
- * @param {number} [length=1] The number of elements to remove. Defaults to 1.
176
- */
177
- delete (index, length = 1) {
178
- if (this.doc !== null) {
179
- transact(this.doc, transaction => {
180
- typeListDelete(transaction, this, index, length)
181
- })
182
- } else {
183
- // @ts-ignore _prelimContent is defined because this is not yet integrated
184
- this._prelimContent.splice(index, length)
185
- }
186
- }
187
-
188
- /**
189
- * Transforms this YArray to a JavaScript Array.
190
- *
191
- * @return {Array<YXmlElement|YXmlText|YXmlHook>}
192
- */
193
- toArray () {
194
- return typeListToArray(this)
195
- }
196
-
197
- /**
198
- * Appends content to this YArray.
199
- *
200
- * @param {Array<YXmlElement|YXmlText>} content Array of content to append.
201
- */
202
- push (content) {
203
- this.insert(this.length, content)
204
- }
205
-
206
- /**
207
- * Prepends content to this YArray.
208
- *
209
- * @param {Array<YXmlElement|YXmlText>} content Array of content to prepend.
210
- */
211
- unshift (content) {
212
- this.insert(0, content)
213
- }
214
-
215
- /**
216
- * Returns the i-th element from a YArray.
217
- *
218
- * @param {number} index The index of the element to return from the YArray
219
- * @return {YXmlElement|YXmlText}
220
- */
221
- get (index) {
222
- return typeListGet(this, index)
223
- }
224
-
225
- /**
226
- * Returns a portion of this YXmlFragment into a JavaScript Array selected
227
- * from start to end (end not included).
228
- *
229
- * @param {number} [start]
230
- * @param {number} [end]
231
- * @return {Array<YXmlElement|YXmlText>}
232
- */
233
- slice (start = 0, end = this.length) {
234
- return typeListSlice(this, start, end)
235
- }
236
-
237
- /**
238
- * Executes a provided function on once on every child element.
239
- *
240
- * @param {function(YXmlElement|YXmlText,number, typeof self):void} f A function to execute on every element of this YArray.
241
- */
242
- forEach (f) {
243
- typeListForEach(this, f)
244
- }
245
-
246
- /**
247
- * Transform the properties of this type to binary and write it to an
248
- * BinaryEncoder.
249
- *
250
- * This is called when this Item is sent to a remote peer.
251
- *
252
- * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
253
- */
254
- _write (encoder) {
255
- encoder.writeTypeRef(YXmlFragmentRefID)
256
- }
257
- }
258
-
259
- /**
260
- * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder
261
- * @return {import('../utils/types.js').YType}
262
- *
263
- * @private
264
- * @function
265
- */
266
- export const readYXmlFragment = _decoder => new YXmlFragment()
@@ -1,68 +0,0 @@
1
- import {
2
- YMap,
3
- YXmlHookRefID,
4
- UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2 // eslint-disable-line
5
- } from '../internals.js'
6
-
7
- /**
8
- * You can manage binding to a custom type with YXmlHook.
9
- *
10
- * @extends {YMap<any>}
11
- */
12
- export class YXmlHook extends YMap {
13
- /**
14
- * @param {string} hookName nodeName of the Dom Node.
15
- */
16
- constructor (hookName) {
17
- super()
18
- /**
19
- * @type {string}
20
- */
21
- this.hookName = hookName
22
- }
23
-
24
- /**
25
- * @return {this}
26
- */
27
- _copy () {
28
- return /** @type {this} */ (new YXmlHook(this.hookName))
29
- }
30
-
31
- /**
32
- * Makes a copy of this data type that can be included somewhere else.
33
- *
34
- * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.
35
- *
36
- * @return {this}
37
- */
38
- clone () {
39
- const el = this._copy()
40
- this.forEach((value, key) => {
41
- el.set(key, value)
42
- })
43
- return el
44
- }
45
-
46
- /**
47
- * Transform the properties of this type to binary and write it to an
48
- * BinaryEncoder.
49
- *
50
- * This is called when this Item is sent to a remote peer.
51
- *
52
- * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
53
- */
54
- _write (encoder) {
55
- encoder.writeTypeRef(YXmlHookRefID)
56
- encoder.writeKey(this.hookName)
57
- }
58
- }
59
-
60
- /**
61
- * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
62
- * @return {import('../utils/types.js').YType}
63
- *
64
- * @private
65
- * @function
66
- */
67
- export const readYXmlHook = decoder =>
68
- new YXmlHook(decoder.readKey())
@@ -1,66 +0,0 @@
1
- import {
2
- YText,
3
- YXmlTextRefID,
4
- ContentType, YXmlElement, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, // eslint-disable-line
5
- } from '../internals.js'
6
-
7
- /**
8
- * @todo can we deprecate this?
9
- *
10
- * Represents text in a Dom Element. In the future this type will also handle
11
- * simple formatting information like bold and italic.
12
- * @extends YText
13
- */
14
- export class YXmlText extends YText {
15
- /**
16
- * @type {YXmlElement|YXmlText|null}
17
- */
18
- get nextSibling () {
19
- const n = this._item ? this._item.next : null
20
- return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null
21
- }
22
-
23
- /**
24
- * @type {YXmlElement|YXmlText|null}
25
- */
26
- get prevSibling () {
27
- const n = this._item ? this._item.prev : null
28
- return n ? /** @type {YXmlElement|YXmlText} */ (/** @type {ContentType} */ (n.content).type) : null
29
- }
30
-
31
- /**
32
- * Makes a copy of this data type that can be included somewhere else.
33
- *
34
- * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.
35
- *
36
- * @return {this}
37
- */
38
- clone () {
39
- const text = /** @type {this} */ (this._copy())
40
- text.applyDelta(this.getContent())
41
- return text
42
- }
43
-
44
- /**
45
- * @return {string}
46
- */
47
- toJSON () {
48
- return this.toString()
49
- }
50
-
51
- /**
52
- * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
53
- */
54
- _write (encoder) {
55
- encoder.writeTypeRef(YXmlTextRefID)
56
- }
57
- }
58
-
59
- /**
60
- * @param {UpdateDecoderV1 | UpdateDecoderV2} _decoder
61
- * @return {import('../utils/types.js').YType}
62
- *
63
- * @private
64
- * @function
65
- */
66
- export const readYXmlText = _decoder => new YXmlText()
@@ -1,25 +0,0 @@
1
- import { ObservableV2 } from 'lib0/observable'
2
-
3
- import {
4
- Doc // eslint-disable-line
5
- } from '../internals.js'
6
-
7
- /**
8
- * This is an abstract interface that all Connectors should implement to keep them interchangeable.
9
- *
10
- * @note This interface is experimental and it is not advised to actually inherit this class.
11
- * It just serves as typing information.
12
- *
13
- * @extends {ObservableV2<any>}
14
- */
15
- export class AbstractConnector extends ObservableV2 {
16
- /**
17
- * @param {Doc} ydoc
18
- * @param {any} awareness
19
- */
20
- constructor (ydoc, awareness) {
21
- super()
22
- this.doc = ydoc
23
- this.awareness = awareness
24
- }
25
- }