@y/y 14.0.0-16

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 (193) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +1406 -0
  3. package/dist/Skip-j0kX7pdq.js +12173 -0
  4. package/dist/Skip-j0kX7pdq.js.map +1 -0
  5. package/dist/Skip-wRT7BKFP.js +11877 -0
  6. package/dist/Skip-wRT7BKFP.js.map +1 -0
  7. package/dist/index-DyTeTfmj.js +163 -0
  8. package/dist/index-DyTeTfmj.js.map +1 -0
  9. package/dist/index-R7GxO-36.js +165 -0
  10. package/dist/index-R7GxO-36.js.map +1 -0
  11. package/dist/internals.cjs +286 -0
  12. package/dist/internals.cjs.map +1 -0
  13. package/dist/internals.mjs +25 -0
  14. package/dist/internals.mjs.map +1 -0
  15. package/dist/src/index.d.ts +2 -0
  16. package/dist/src/index.d.ts.map +1 -0
  17. package/dist/src/internals.d.ts +43 -0
  18. package/dist/src/internals.d.ts.map +1 -0
  19. package/dist/src/structs/AbstractStruct.d.ts +42 -0
  20. package/dist/src/structs/AbstractStruct.d.ts.map +1 -0
  21. package/dist/src/structs/ContentAny.d.ts +67 -0
  22. package/dist/src/structs/ContentAny.d.ts.map +1 -0
  23. package/dist/src/structs/ContentBinary.d.ts +64 -0
  24. package/dist/src/structs/ContentBinary.d.ts.map +1 -0
  25. package/dist/src/structs/ContentDeleted.d.ts +64 -0
  26. package/dist/src/structs/ContentDeleted.d.ts.map +1 -0
  27. package/dist/src/structs/ContentDoc.d.ts +72 -0
  28. package/dist/src/structs/ContentDoc.d.ts.map +1 -0
  29. package/dist/src/structs/ContentEmbed.d.ts +67 -0
  30. package/dist/src/structs/ContentEmbed.d.ts.map +1 -0
  31. package/dist/src/structs/ContentFormat.d.ts +69 -0
  32. package/dist/src/structs/ContentFormat.d.ts.map +1 -0
  33. package/dist/src/structs/ContentJSON.d.ts +70 -0
  34. package/dist/src/structs/ContentJSON.d.ts.map +1 -0
  35. package/dist/src/structs/ContentString.d.ts +70 -0
  36. package/dist/src/structs/ContentString.d.ts.map +1 -0
  37. package/dist/src/structs/ContentType.d.ts +83 -0
  38. package/dist/src/structs/ContentType.d.ts.map +1 -0
  39. package/dist/src/structs/GC.d.ts +31 -0
  40. package/dist/src/structs/GC.d.ts.map +1 -0
  41. package/dist/src/structs/Item.d.ts +212 -0
  42. package/dist/src/structs/Item.d.ts.map +1 -0
  43. package/dist/src/structs/Skip.d.ts +33 -0
  44. package/dist/src/structs/Skip.d.ts.map +1 -0
  45. package/dist/src/types/AbstractType.d.ts +239 -0
  46. package/dist/src/types/AbstractType.d.ts.map +1 -0
  47. package/dist/src/types/YArray.d.ts +128 -0
  48. package/dist/src/types/YArray.d.ts.map +1 -0
  49. package/dist/src/types/YMap.d.ts +112 -0
  50. package/dist/src/types/YMap.d.ts.map +1 -0
  51. package/dist/src/types/YText.d.ts +216 -0
  52. package/dist/src/types/YText.d.ts.map +1 -0
  53. package/dist/src/types/YXmlElement.d.ts +106 -0
  54. package/dist/src/types/YXmlElement.d.ts.map +1 -0
  55. package/dist/src/types/YXmlFragment.d.ts +143 -0
  56. package/dist/src/types/YXmlFragment.d.ts.map +1 -0
  57. package/dist/src/types/YXmlHook.d.ts +32 -0
  58. package/dist/src/types/YXmlHook.d.ts.map +1 -0
  59. package/dist/src/types/YXmlText.d.ts +34 -0
  60. package/dist/src/types/YXmlText.d.ts.map +1 -0
  61. package/dist/src/utils/AbstractConnector.d.ts +20 -0
  62. package/dist/src/utils/AbstractConnector.d.ts.map +1 -0
  63. package/dist/src/utils/AttributionManager.d.ts +224 -0
  64. package/dist/src/utils/AttributionManager.d.ts.map +1 -0
  65. package/dist/src/utils/Doc.d.ts +267 -0
  66. package/dist/src/utils/Doc.d.ts.map +1 -0
  67. package/dist/src/utils/EventHandler.d.ts +19 -0
  68. package/dist/src/utils/EventHandler.d.ts.map +1 -0
  69. package/dist/src/utils/ID.d.ts +26 -0
  70. package/dist/src/utils/ID.d.ts.map +1 -0
  71. package/dist/src/utils/IdMap.d.ts +161 -0
  72. package/dist/src/utils/IdMap.d.ts.map +1 -0
  73. package/dist/src/utils/IdSet.d.ts +163 -0
  74. package/dist/src/utils/IdSet.d.ts.map +1 -0
  75. package/dist/src/utils/RelativePosition.d.ts +91 -0
  76. package/dist/src/utils/RelativePosition.d.ts.map +1 -0
  77. package/dist/src/utils/Snapshot.d.ts +40 -0
  78. package/dist/src/utils/Snapshot.d.ts.map +1 -0
  79. package/dist/src/utils/StructSet.d.ts +27 -0
  80. package/dist/src/utils/StructSet.d.ts.map +1 -0
  81. package/dist/src/utils/StructStore.d.ts +41 -0
  82. package/dist/src/utils/StructStore.d.ts.map +1 -0
  83. package/dist/src/utils/Transaction.d.ts +136 -0
  84. package/dist/src/utils/Transaction.d.ts.map +1 -0
  85. package/dist/src/utils/UndoManager.d.ts +188 -0
  86. package/dist/src/utils/UndoManager.d.ts.map +1 -0
  87. package/dist/src/utils/UpdateDecoder.d.ts +167 -0
  88. package/dist/src/utils/UpdateDecoder.d.ts.map +1 -0
  89. package/dist/src/utils/UpdateEncoder.d.ts +164 -0
  90. package/dist/src/utils/UpdateEncoder.d.ts.map +1 -0
  91. package/dist/src/utils/YEvent.d.ts +120 -0
  92. package/dist/src/utils/YEvent.d.ts.map +1 -0
  93. package/dist/src/utils/delta-helpers.d.ts +6 -0
  94. package/dist/src/utils/delta-helpers.d.ts.map +1 -0
  95. package/dist/src/utils/encoding.d.ts +30 -0
  96. package/dist/src/utils/encoding.d.ts.map +1 -0
  97. package/dist/src/utils/isParentOf.d.ts +3 -0
  98. package/dist/src/utils/isParentOf.d.ts.map +1 -0
  99. package/dist/src/utils/logging.d.ts +3 -0
  100. package/dist/src/utils/logging.d.ts.map +1 -0
  101. package/dist/src/utils/types.d.ts +7 -0
  102. package/dist/src/utils/types.d.ts.map +1 -0
  103. package/dist/src/utils/updates.d.ts +89 -0
  104. package/dist/src/utils/updates.d.ts.map +1 -0
  105. package/dist/testHelper.cjs +780 -0
  106. package/dist/testHelper.cjs.map +1 -0
  107. package/dist/testHelper.mjs +617 -0
  108. package/dist/testHelper.mjs.map +1 -0
  109. package/dist/tests/IdMap.tests.d.ts +9 -0
  110. package/dist/tests/IdMap.tests.d.ts.map +1 -0
  111. package/dist/tests/IdSet.tests.d.ts +9 -0
  112. package/dist/tests/IdSet.tests.d.ts.map +1 -0
  113. package/dist/tests/attribution.tests.d.ts +8 -0
  114. package/dist/tests/attribution.tests.d.ts.map +1 -0
  115. package/dist/tests/compatibility.tests.d.ts +5 -0
  116. package/dist/tests/compatibility.tests.d.ts.map +1 -0
  117. package/dist/tests/delta.tests.d.ts +7 -0
  118. package/dist/tests/delta.tests.d.ts.map +1 -0
  119. package/dist/tests/doc.tests.d.ts +13 -0
  120. package/dist/tests/doc.tests.d.ts.map +1 -0
  121. package/dist/tests/encoding.tests.d.ts +5 -0
  122. package/dist/tests/encoding.tests.d.ts.map +1 -0
  123. package/dist/tests/index.d.ts +2 -0
  124. package/dist/tests/index.d.ts.map +1 -0
  125. package/dist/tests/relativePositions.tests.d.ts +11 -0
  126. package/dist/tests/relativePositions.tests.d.ts.map +1 -0
  127. package/dist/tests/snapshot.tests.d.ts +13 -0
  128. package/dist/tests/snapshot.tests.d.ts.map +1 -0
  129. package/dist/tests/testHelper.d.ts +167 -0
  130. package/dist/tests/testHelper.d.ts.map +1 -0
  131. package/dist/tests/undo-redo.tests.d.ts +27 -0
  132. package/dist/tests/undo-redo.tests.d.ts.map +1 -0
  133. package/dist/tests/updates.tests.d.ts +24 -0
  134. package/dist/tests/updates.tests.d.ts.map +1 -0
  135. package/dist/tests/y-array.tests.d.ts +45 -0
  136. package/dist/tests/y-array.tests.d.ts.map +1 -0
  137. package/dist/tests/y-map.tests.d.ts +45 -0
  138. package/dist/tests/y-map.tests.d.ts.map +1 -0
  139. package/dist/tests/y-text.tests.d.ts +49 -0
  140. package/dist/tests/y-text.tests.d.ts.map +1 -0
  141. package/dist/tests/y-xml.tests.d.ts +15 -0
  142. package/dist/tests/y-xml.tests.d.ts.map +1 -0
  143. package/dist/yjs.cjs +151 -0
  144. package/dist/yjs.cjs.map +1 -0
  145. package/dist/yjs.mjs +26 -0
  146. package/dist/yjs.mjs.map +1 -0
  147. package/package.json +101 -0
  148. package/src/index.js +153 -0
  149. package/src/internals.js +44 -0
  150. package/src/structs/AbstractStruct.js +59 -0
  151. package/src/structs/ContentAny.js +115 -0
  152. package/src/structs/ContentBinary.js +93 -0
  153. package/src/structs/ContentDeleted.js +101 -0
  154. package/src/structs/ContentDoc.js +141 -0
  155. package/src/structs/ContentEmbed.js +98 -0
  156. package/src/structs/ContentFormat.js +105 -0
  157. package/src/structs/ContentJSON.js +119 -0
  158. package/src/structs/ContentString.js +113 -0
  159. package/src/structs/ContentType.js +176 -0
  160. package/src/structs/GC.js +80 -0
  161. package/src/structs/Item.js +845 -0
  162. package/src/structs/Skip.js +75 -0
  163. package/src/types/AbstractType.js +1434 -0
  164. package/src/types/YArray.js +270 -0
  165. package/src/types/YMap.js +244 -0
  166. package/src/types/YText.js +934 -0
  167. package/src/types/YXmlElement.js +227 -0
  168. package/src/types/YXmlFragment.js +266 -0
  169. package/src/types/YXmlHook.js +68 -0
  170. package/src/types/YXmlText.js +66 -0
  171. package/src/utils/AbstractConnector.js +25 -0
  172. package/src/utils/AttributionManager.js +619 -0
  173. package/src/utils/Doc.js +372 -0
  174. package/src/utils/EventHandler.js +87 -0
  175. package/src/utils/ID.js +89 -0
  176. package/src/utils/IdMap.js +629 -0
  177. package/src/utils/IdSet.js +823 -0
  178. package/src/utils/RelativePosition.js +352 -0
  179. package/src/utils/Snapshot.js +220 -0
  180. package/src/utils/StructSet.js +137 -0
  181. package/src/utils/StructStore.js +289 -0
  182. package/src/utils/Transaction.js +489 -0
  183. package/src/utils/UndoManager.js +391 -0
  184. package/src/utils/UpdateDecoder.js +281 -0
  185. package/src/utils/UpdateEncoder.js +320 -0
  186. package/src/utils/YEvent.js +216 -0
  187. package/src/utils/delta-helpers.js +54 -0
  188. package/src/utils/encoding.js +623 -0
  189. package/src/utils/isParentOf.js +21 -0
  190. package/src/utils/logging.js +21 -0
  191. package/src/utils/types.js +28 -0
  192. package/src/utils/updates.js +715 -0
  193. package/tests/testHelper.js +600 -0
@@ -0,0 +1,216 @@
1
+ export class ItemTextListPosition {
2
+ /**
3
+ * @param {Item|null} left
4
+ * @param {Item|null} right
5
+ * @param {number} index
6
+ * @param {Map<string,any>} currentAttributes
7
+ * @param {AbstractAttributionManager} am
8
+ */
9
+ constructor(left: Item | null, right: Item | null, index: number, currentAttributes: Map<string, any>, am: AbstractAttributionManager);
10
+ left: Item | null;
11
+ right: Item | null;
12
+ index: number;
13
+ currentAttributes: Map<string, any>;
14
+ am: AbstractAttributionManager;
15
+ /**
16
+ * Only call this if you know that this.right is defined
17
+ */
18
+ forward(): void;
19
+ /**
20
+ * @param {Transaction} transaction
21
+ * @param {import('../utils/types.js').YType} parent
22
+ * @param {number} length
23
+ * @param {Object<string,any>} attributes
24
+ *
25
+ * @function
26
+ */
27
+ formatText(transaction: Transaction, parent: import("../utils/types.js").YType, length: number, attributes: {
28
+ [x: string]: any;
29
+ }): void;
30
+ }
31
+ export function insertText(transaction: Transaction, parent: import("../utils/types.js").YType, currPos: ItemTextListPosition, text: string | object | import("../utils/types.js").YType, attributes: {
32
+ [x: string]: any;
33
+ }): void;
34
+ export function cleanupYTextFormatting(type: YText<any>): number;
35
+ export function cleanupYTextAfterTransaction(transaction: Transaction): void;
36
+ export function deleteText(transaction: Transaction, currPos: ItemTextListPosition, length: number): ItemTextListPosition;
37
+ /**
38
+ * The Quill Delta format represents changes on a text document with
39
+ * formatting information. For more information visit {@link https://quilljs.com/docs/delta/|Quill Delta}
40
+ *
41
+ * @example
42
+ * {
43
+ * ops: [
44
+ * { insert: 'Gandalf', attributes: { bold: true } },
45
+ * { insert: ' the ' },
46
+ * { insert: 'Grey', attributes: { color: '#cccccc' } }
47
+ * ]
48
+ * }
49
+ *
50
+ */
51
+ /**
52
+ * Attributes that can be assigned to a selection of text.
53
+ *
54
+ * @example
55
+ * {
56
+ * bold: true,
57
+ * font-size: '40px'
58
+ * }
59
+ *
60
+ * @typedef {Object} TextAttributes
61
+ */
62
+ /**
63
+ * Type that represents text with formatting information.
64
+ *
65
+ * This type replaces y-richtext as this implementation is able to handle
66
+ * block formats (format information on a paragraph), embeds (complex elements
67
+ * like pictures and videos), and text formats (**bold**, *italic*).
68
+ *
69
+ * @template {{ [key:string]:any } | import('../utils/types.js').YType} [Embeds={ [key:string]:any } | import('../utils/types.js').YType]
70
+ * @extends {AbstractType<import('lib0/delta').TextDelta<Embeds>>}
71
+ */
72
+ export class YText<Embeds extends {
73
+ [key: string]: any;
74
+ } | import("../utils/types.js").YType = AbstractType<any, any> | {
75
+ [key: string]: any;
76
+ }> extends AbstractType<import("lib0/delta").TextDelta<Embeds>, any> {
77
+ /**
78
+ * @param {String} [string] The initial value of the YText.
79
+ */
80
+ constructor(string?: string);
81
+ /**
82
+ * Array of pending operations on this type
83
+ * @type {Array<function():void>?}
84
+ */
85
+ _pending: Array<() => void> | null;
86
+ /**
87
+ * Whether this YText contains formatting attributes.
88
+ * This flag is updated when a formatting item is integrated (see ContentFormat.integrate)
89
+ */
90
+ _hasFormatting: boolean;
91
+ /**
92
+ * Number of characters of this text type.
93
+ *
94
+ * @type {number}
95
+ */
96
+ get length(): number;
97
+ /**
98
+ * Makes a copy of this data type that can be included somewhere else.
99
+ *
100
+ * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.
101
+ *
102
+ * @return {YText<Embeds>}
103
+ */
104
+ clone(): YText<Embeds>;
105
+ /**
106
+ * Returns the unformatted string representation of this YText type.
107
+ *
108
+ * @return {string}
109
+ * @public
110
+ */
111
+ public toJSON(): string;
112
+ /**
113
+ * Insert text at a given index.
114
+ *
115
+ * @param {number} index The index at which to start inserting.
116
+ * @param {String} text The text to insert at the specified position.
117
+ * @param {TextAttributes} [attributes] Optionally define some formatting
118
+ * information to apply on the inserted
119
+ * Text.
120
+ * @public
121
+ */
122
+ public insert(index: number, text: string, attributes?: TextAttributes): void;
123
+ /**
124
+ * Inserts an embed at a index.
125
+ *
126
+ * @param {number} index The index to insert the embed at.
127
+ * @param {Object | AbstractType<any>} embed The Object that represents the embed.
128
+ * @param {TextAttributes} [attributes] Attribute information to apply on the
129
+ * embed
130
+ *
131
+ * @public
132
+ */
133
+ public insertEmbed(index: number, embed: Object | AbstractType<any>, attributes?: TextAttributes): void;
134
+ /**
135
+ * Deletes text starting from an index.
136
+ *
137
+ * @param {number} index Index at which to start deleting.
138
+ * @param {number} length The number of characters to remove. Defaults to 1.
139
+ *
140
+ * @public
141
+ */
142
+ public delete(index: number, length: number): void;
143
+ /**
144
+ * Assigns properties to a range of text.
145
+ *
146
+ * @param {number} index The position where to start formatting.
147
+ * @param {number} length The amount of characters to assign properties to.
148
+ * @param {TextAttributes} attributes Attribute information to apply on the
149
+ * text.
150
+ *
151
+ * @public
152
+ */
153
+ public format(index: number, length: number, attributes: TextAttributes): void;
154
+ /**
155
+ * Removes an attribute.
156
+ *
157
+ * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.
158
+ *
159
+ * @param {String} attributeName The attribute name that is to be removed.
160
+ *
161
+ * @public
162
+ */
163
+ public removeAttribute(attributeName: string): void;
164
+ /**
165
+ * Sets or updates an attribute.
166
+ *
167
+ * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.
168
+ *
169
+ * @param {String} attributeName The attribute name that is to be set.
170
+ * @param {any} attributeValue The attribute value that is to be set.
171
+ *
172
+ * @public
173
+ */
174
+ public setAttribute(attributeName: string, attributeValue: any): void;
175
+ /**
176
+ * Returns an attribute value that belongs to the attribute name.
177
+ *
178
+ * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.
179
+ *
180
+ * @param {String} attributeName The attribute name that identifies the
181
+ * queried value.
182
+ * @return {any} The queried attribute value.
183
+ *
184
+ * @public
185
+ */
186
+ public getAttribute(attributeName: string): any;
187
+ /**
188
+ * Returns all attribute name/value pairs in a JSON Object.
189
+ *
190
+ * @note Xml-Text nodes don't have attributes. You can use this feature to assign properties to complete text-blocks.
191
+ *
192
+ * @return {Object<string, any>} A JSON Object that describes the attributes.
193
+ *
194
+ * @public
195
+ */
196
+ public getAttributes(): {
197
+ [x: string]: any;
198
+ };
199
+ /**
200
+ * @param {this} other
201
+ */
202
+ [traits.EqualityTraitSymbol](other: this): boolean;
203
+ }
204
+ export function readYText(_decoder: UpdateDecoderV1 | UpdateDecoderV2): import("../utils/types.js").YType;
205
+ /**
206
+ * Attributes that can be assigned to a selection of text.
207
+ */
208
+ export type TextAttributes = Object;
209
+ import { Item } from '../internals.js';
210
+ import { AbstractAttributionManager } from '../internals.js';
211
+ import { Transaction } from '../internals.js';
212
+ import { AbstractType } from '../internals.js';
213
+ import * as traits from 'lib0/traits';
214
+ import { UpdateDecoderV1 } from '../internals.js';
215
+ import { UpdateDecoderV2 } from '../internals.js';
216
+ //# sourceMappingURL=YText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YText.d.ts","sourceRoot":"","sources":["../../../src/types/YText.js"],"names":[],"mappings":"AAkCA;IACE;;;;;;OAMG;IACH,kBANW,IAAI,GAAC,IAAI,SACT,IAAI,GAAC,IAAI,SACT,MAAM,qBACN,GAAG,CAAC,MAAM,EAAC,GAAG,CAAC,MACf,0BAA0B,EAQpC;IALC,kBAAgB;IAChB,mBAAkB;IAClB,cAAkB;IAClB,oCAA0C;IAC1C,+BAAY;IAGd;;OAEG;IACH,gBAgBC;IAED;;;;;;;OAOG;IACH,wBAPW,WAAW,UACX,OAAO,mBAAmB,EAAE,KAAK,UACjC,MAAM;;aAuFhB;CACF;AA8KM,wCATI,WAAW,UACX,OAAO,mBAAmB,EAAE,KAAK,WACjC,oBAAoB,QACpB,MAAM,GAAC,MAAM,GAAC,OAAO,mBAAmB,EAAE,KAAK;;SA4BzD;AA2GM,6CAHI,KAAK,C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AiB;gCAAjB,iBAAiB"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * @typedef {Object|number|null|Array<any>|string|Uint8Array|AbstractType<any>} ValueTypes
3
+ */
4
+ /**
5
+ * An YXmlElement imitates the behavior of a
6
+ * https://developer.mozilla.org/en-US/docs/Web/API/Element|Dom Element
7
+ *
8
+ * * An YXmlElement has attributes (key value pairs)
9
+ * * An YXmlElement has childElements that must inherit from YXmlElement
10
+ *
11
+ * @template {{ [key: string]: any }} [Attrs={ [key: string]: string }]
12
+ * @template {any} [Children=any]
13
+ * @extends YXmlFragment<Children,Attrs>
14
+ */
15
+ export class YXmlElement<Attrs extends {
16
+ [key: string]: any;
17
+ } = {
18
+ [key: string]: string;
19
+ }, Children extends unknown = any> extends YXmlFragment<Children, Attrs> {
20
+ constructor(nodeName?: string);
21
+ nodeName: string;
22
+ /**
23
+ * @type {Map<string, any>|null}
24
+ */
25
+ _prelimAttrs: Map<string, any> | null;
26
+ /**
27
+ * @type {YXmlElement|YXmlText|null}
28
+ */
29
+ get nextSibling(): YXmlElement | YXmlText | null;
30
+ /**
31
+ * @type {YXmlElement|YXmlText|null}
32
+ */
33
+ get prevSibling(): YXmlElement | YXmlText | null;
34
+ /**
35
+ * Creates an Item with the same effect as this Item (without position effect)
36
+ *
37
+ * @return {this}
38
+ */
39
+ _copy(): this;
40
+ /**
41
+ * Makes a copy of this data type that can be included somewhere else.
42
+ *
43
+ * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.
44
+ *
45
+ * @return {this}
46
+ */
47
+ clone(): this;
48
+ /**
49
+ * Removes an attribute from this YXmlElement.
50
+ *
51
+ * @param {string} attributeName The attribute name that is to be removed.
52
+ *
53
+ * @public
54
+ */
55
+ public removeAttribute(attributeName: string): void;
56
+ /**
57
+ * Sets or updates an attribute.
58
+ *
59
+ * @template {keyof Attrs & string} KEY
60
+ *
61
+ * @param {KEY} attributeName The attribute name that is to be set.
62
+ * @param {Attrs[KEY]} attributeValue The attribute value that is to be set.
63
+ *
64
+ * @public
65
+ */
66
+ public setAttribute<KEY extends keyof Attrs & string>(attributeName: KEY, attributeValue: Attrs[KEY]): void;
67
+ /**
68
+ * Returns an attribute value that belongs to the attribute name.
69
+ *
70
+ * @template {keyof Attrs & string} KEY
71
+ *
72
+ * @param {KEY} attributeName The attribute name that identifies the
73
+ * queried value.
74
+ * @return {Attrs[KEY]|undefined} The queried attribute value.
75
+ *
76
+ * @public
77
+ */
78
+ public getAttribute<KEY extends keyof Attrs & string>(attributeName: KEY): Attrs[KEY] | undefined;
79
+ /**
80
+ * Returns whether an attribute exists
81
+ *
82
+ * @param {string} attributeName The attribute name to check for existence.
83
+ * @return {boolean} whether the attribute exists.
84
+ *
85
+ * @public
86
+ */
87
+ public hasAttribute(attributeName: string): boolean;
88
+ /**
89
+ * Returns all attribute name/value pairs in a JSON Object.
90
+ *
91
+ * @param {Snapshot} [snapshot]
92
+ * @return {{ [Key in Extract<keyof Attrs,string>]?: Attrs[Key]}} A JSON Object that describes the attributes.
93
+ *
94
+ * @public
95
+ */
96
+ public getAttributes(snapshot?: Snapshot): { [Key in Extract<keyof Attrs, string>]?: Attrs[Key]; };
97
+ }
98
+ export function readYXmlElement(decoder: UpdateDecoderV1 | UpdateDecoderV2): import("../utils/types.js").YType;
99
+ export type ValueTypes = Object | number | null | Array<any> | string | Uint8Array | AbstractType<any>;
100
+ import { YXmlFragment } from '../internals.js';
101
+ import { YXmlText } from '../internals.js';
102
+ import { Snapshot } from '../internals.js';
103
+ import { UpdateDecoderV1 } from '../internals.js';
104
+ import { UpdateDecoderV2 } from '../internals.js';
105
+ import { AbstractType } from '../internals.js';
106
+ //# sourceMappingURL=YXmlElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YXmlElement.d.ts","sourceRoot":"","sources":["../../../src/types/YXmlElement.js"],"names":[],"mappings":"AAeA;;GAEG;AAEH;;;;;;;;;;GAUG;AACH,yBAJuC,KAAK,SAA/B;IAAG,CAAC,GAAG,EAAE,MA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https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors}
4
+ *
5
+ * @example
6
+ * query = '.classSelector'
7
+ * query = 'nodeSelector'
8
+ * query = '#idSelector'
9
+ *
10
+ * @typedef {string} CSS_Selector
11
+ */
12
+ /**
13
+ * Dom filter function.
14
+ *
15
+ * @callback domFilter
16
+ * @param {string} nodeName The nodeName of the element
17
+ * @param {Map} attributes The map of attributes.
18
+ * @return {boolean} Whether to include the Dom node in the YXmlElement.
19
+ */
20
+ /**
21
+ * Represents a list of {@link YXmlElement}.and {@link YXmlText} types.
22
+ * A YxmlFragment is similar to a {@link YXmlElement}, but it does not have a
23
+ * nodeName and it does not have attributes. Though it can be bound to a DOM
24
+ * element - in this case the attributes and the nodeName are not shared.
25
+ *
26
+ * @public
27
+ * @template {any} [Children=any]
28
+ * @template {{[K in string]:any}} [Attrs={}]
29
+ * @extends AbstractType<delta.Delta<any,Attrs,Children,any>>
30
+ */
31
+ export class YXmlFragment<Children extends unknown = any, Attrs extends { [K in string]: any; } = {}> extends AbstractType<delta.Delta<any, Attrs, Children, any, any>, any> {
32
+ constructor();
33
+ /**
34
+ * @todo remove _prelimContent
35
+ * @type {Array<any>|null}
36
+ */
37
+ _prelimContent: Array<any> | null;
38
+ /**
39
+ * @type {YXmlElement|YXmlText|null}
40
+ */
41
+ get firstChild(): YXmlElement | YXmlText | null;
42
+ /**
43
+ * Makes a copy of this data type that can be included somewhere else.
44
+ *
45
+ * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.
46
+ *
47
+ * @return {this}
48
+ */
49
+ clone(): this;
50
+ get length(): number;
51
+ /**
52
+ * @return {string}
53
+ */
54
+ toJSON(): string;
55
+ /**
56
+ * Inserts new content at an index.
57
+ *
58
+ * @example
59
+ * // Insert character 'a' at position 0
60
+ * xml.insert(0, [new Y.XmlText('text')])
61
+ *
62
+ * @param {number} index The index to insert content at
63
+ * @param {Array<YXmlElement|YXmlText|YXmlHook>} content The array of content
64
+ */
65
+ insert(index: number, content: Array<YXmlElement | YXmlText | YXmlHook>): void;
66
+ /**
67
+ * Inserts new content at an index.
68
+ *
69
+ * @example
70
+ * // Insert character 'a' at position 0
71
+ * xml.insert(0, [new Y.XmlText('text')])
72
+ *
73
+ * @param {null|Item|YXmlElement|YXmlText} ref The index to insert content at
74
+ * @param {Array<YXmlElement|YXmlText>} content The array of content
75
+ */
76
+ insertAfter(ref: null | Item | YXmlElement | YXmlText, content: Array<YXmlElement | YXmlText>): void;
77
+ /**
78
+ * Deletes elements starting from an index.
79
+ *
80
+ * @param {number} index Index at which to start deleting elements
81
+ * @param {number} [length=1] The number of elements to remove. Defaults to 1.
82
+ */
83
+ delete(index: number, length?: number): void;
84
+ /**
85
+ * Transforms this YArray to a JavaScript Array.
86
+ *
87
+ * @return {Array<YXmlElement|YXmlText|YXmlHook>}
88
+ */
89
+ toArray(): Array<YXmlElement | YXmlText | YXmlHook>;
90
+ /**
91
+ * Appends content to this YArray.
92
+ *
93
+ * @param {Array<YXmlElement|YXmlText>} content Array of content to append.
94
+ */
95
+ push(content: Array<YXmlElement | YXmlText>): void;
96
+ /**
97
+ * Prepends content to this YArray.
98
+ *
99
+ * @param {Array<YXmlElement|YXmlText>} content Array of content to prepend.
100
+ */
101
+ unshift(content: Array<YXmlElement | YXmlText>): void;
102
+ /**
103
+ * Returns the i-th element from a YArray.
104
+ *
105
+ * @param {number} index The index of the element to return from the YArray
106
+ * @return {YXmlElement|YXmlText}
107
+ */
108
+ get(index: number): YXmlElement | YXmlText;
109
+ /**
110
+ * Returns a portion of this YXmlFragment into a JavaScript Array selected
111
+ * from start to end (end not included).
112
+ *
113
+ * @param {number} [start]
114
+ * @param {number} [end]
115
+ * @return {Array<YXmlElement|YXmlText>}
116
+ */
117
+ slice(start?: number, end?: number): Array<YXmlElement | YXmlText>;
118
+ /**
119
+ * Executes a provided function on once on every child element.
120
+ *
121
+ * @param {function(YXmlElement|YXmlText,number, typeof self):void} f A function to execute on every element of this YArray.
122
+ */
123
+ forEach(f: (arg0: YXmlElement | YXmlText, arg1: number, arg2: typeof self) => void): void;
124
+ }
125
+ export function readYXmlFragment(_decoder: UpdateDecoderV1 | UpdateDecoderV2): import("../utils/types.js").YType;
126
+ /**
127
+ * Define the elements to which a set of CSS queries apply.
128
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors}
129
+ */
130
+ export type CSS_Selector = string;
131
+ /**
132
+ * Dom filter function.
133
+ */
134
+ export type domFilter = (nodeName: string, attributes: Map<any, any>) => boolean;
135
+ import * as delta from 'lib0/delta';
136
+ import { AbstractType } from '../internals.js';
137
+ import { YXmlElement } from '../internals.js';
138
+ import { YXmlText } from '../internals.js';
139
+ import { YXmlHook } from '../internals.js';
140
+ import { Item } from '../internals.js';
141
+ import { UpdateDecoderV1 } from '../internals.js';
142
+ import { UpdateDecoderV2 } from '../internals.js';
143
+ //# sourceMappingURL=YXmlFragment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YXmlFragment.d.ts","sourceRoot":"","sources":["../../../src/types/YXmlFragment.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;GAUG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;;GAUG;AACH,0BAJoB,QAAQ,wBACQ,KAAK,SAA5B,GAAG,CAAC,IAAI,MAAM,GAAE,GAAG,GAAE;IAIhC,cAOC;IALC;;;OAGG;IACH,gBAFU,KAAK,CAAC,GAAG,CAAC,GAAC,IAAI,CAED;IAG1B;;OAEG;IACH,kBAFU,WAAW,GAAC,QAAQ,GAAC,IAAI,CAKlC;IAkBD;;;;;;OAMG;IACH,SAFY,IAAI,CAMf;IAED,qBAGC;IAWD;;OAEG;IACH,UAFY,MAAM,CAIjB;IAED;;;;;;;;;OASG;IACH,cAHW,MAAM,WACN,KAAK,CAAC,WAAW,GAAC,QAAQ,GAAC,QAAQ,CAAC,QAW9C;IAED;;;;;;;;;OASG;IACH,iBAHW,IAAI,GAAC,IAAI,GAAC,WAAW,GAAC,QAAQ,WAC9B,KAAK,CAAC,WAAW,GAAC,QAAQ,CAAC,QAgBrC;IAED;;;;;OAKG;IACH,cAHW,MAAM,WACN,MAAM,QAWhB;IAED;;;;OAIG;IACH,WAFY,KAAK,CAAC,WAAW,GAAC,QAAQ,GAAC,QAAQ,CAAC,CAI/C;IAED;;;;OAIG;IACH,cAFW,KAAK,CAAC,WAAW,GAAC,QAAQ,CAAC,QAIrC;IAED;;;;OAIG;IACH,iBAFW,KAAK,CAAC,WAAW,GAAC,QAAQ,CAAC,QAIrC;IAED;;;;;OAKG;IACH,WAHW,MAAM,GACL,WAAW,GAAC,QAAQ,CAI/B;IAED;;;;;;;OAOG;IACH,cAJW,MAAM,QACN,MAAM,GACL,KAAK,CAAC,WAAW,GAAC,QAAQ,CAAC,CAItC;IAED;;;;OAIG;IACH,WAFW,CAAS,IAAoB,EAApB,WAAW,GAAC,QAAQ,EAAC,IAAM,EAAN,MAAM,EAAE,IAAW,EAAX,OAAO,IAAI,KAAE,IAAI,QAIjE;CAaF;AASM,2CANI,eAAe,GAAG,eAAe,GAChC,OAAO,mBAAmB,EAAE,KAAK,CAKiB;;;;;2BAzOjD,MAAM;;;;mCAOR,MAAM,gCAEL,OAAO;uBArBI,YAAY;6BAF5B,iBAAiB;4BAAjB,iBAAiB;yBAAjB,iBAAiB;yBAAjB,iBAAiB;qBAAjB,iBAAiB;gCAAjB,iBAAiB;gCAAjB,iBAAiB"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * You can manage binding to a custom type with YXmlHook.
3
+ *
4
+ * @extends {YMap<any>}
5
+ */
6
+ export class YXmlHook extends YMap<any> {
7
+ /**
8
+ * @param {string} hookName nodeName of the Dom Node.
9
+ */
10
+ constructor(hookName: string);
11
+ /**
12
+ * @type {string}
13
+ */
14
+ hookName: string;
15
+ /**
16
+ * @return {this}
17
+ */
18
+ _copy(): this;
19
+ /**
20
+ * Makes a copy of this data type that can be included somewhere else.
21
+ *
22
+ * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.
23
+ *
24
+ * @return {this}
25
+ */
26
+ clone(): this;
27
+ }
28
+ export function readYXmlHook(decoder: UpdateDecoderV1 | UpdateDecoderV2): import("../utils/types.js").YType;
29
+ import { YMap } from '../internals.js';
30
+ import { UpdateDecoderV1 } from '../internals.js';
31
+ import { UpdateDecoderV2 } from '../internals.js';
32
+ //# sourceMappingURL=YXmlHook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YXmlHook.d.ts","sourceRoot":"","sources":["../../../src/types/YXmlHook.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH;IACE;;OAEG;IACH,sBAFW,MAAM,EAQhB;IAJC;;OAEG;IACH,UAFU,MAAM,CAEQ;IAG1B;;OAEG;IACH,SAFY,IAAI,CAIf;IAED;;;;;;OAMG;IACH,SAFY,IAAI,CAQf;CAcF;AASM,sCANI,eAAe,GAAG,eAAe,GAChC,OAAO,mBAAmB,EAAE,KAAK,CAMZ;qBA/D1B,iBAAiB;gCAAjB,iBAAiB;gCAAjB,iBAAiB"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @todo can we deprecate this?
3
+ *
4
+ * Represents text in a Dom Element. In the future this type will also handle
5
+ * simple formatting information like bold and italic.
6
+ * @extends YText
7
+ */
8
+ export class YXmlText extends YText<import("./AbstractType.js").AbstractType<any, any> | {
9
+ [key: string]: any;
10
+ }> {
11
+ constructor(string?: string);
12
+ /**
13
+ * @type {YXmlElement|YXmlText|null}
14
+ */
15
+ get nextSibling(): YXmlElement | YXmlText | null;
16
+ /**
17
+ * @type {YXmlElement|YXmlText|null}
18
+ */
19
+ get prevSibling(): YXmlElement | YXmlText | null;
20
+ /**
21
+ * Makes a copy of this data type that can be included somewhere else.
22
+ *
23
+ * Note that the content is only readable _after_ it has been included somewhere in the Ydoc.
24
+ *
25
+ * @return {this}
26
+ */
27
+ clone(): this;
28
+ }
29
+ export function readYXmlText(_decoder: UpdateDecoderV1 | UpdateDecoderV2): import("../utils/types.js").YType;
30
+ import { YText } from '../internals.js';
31
+ import { YXmlElement } from '../internals.js';
32
+ import { UpdateDecoderV1 } from '../internals.js';
33
+ import { UpdateDecoderV2 } from '../internals.js';
34
+ //# sourceMappingURL=YXmlText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YXmlText.d.ts","sourceRoot":"","sources":["../../../src/types/YXmlText.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH;;;;IACE;;OAEG;IACH,mBAFU,WAAW,GAAC,QAAQ,GAAC,IAAI,CAKlC;IAED;;OAEG;IACH,mBAFU,WAAW,GAAC,QAAQ,GAAC,IAAI,CAKlC;IAED;;;;;;OAMG;IACH,SAFY,IAAI,CAMf;CAeF;AASM,uCANI,eAAe,GAAG,eAAe,GAChC,OAAO,mBAAmB,EAAE,KAAK,CAKS;sBA7D/C,iBAAiB;4BAAjB,iBAAiB;gCAAjB,iBAAiB;gCAAjB,iBAAiB"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This is an abstract interface that all Connectors should implement to keep them interchangeable.
3
+ *
4
+ * @note This interface is experimental and it is not advised to actually inherit this class.
5
+ * It just serves as typing information.
6
+ *
7
+ * @extends {ObservableV2<any>}
8
+ */
9
+ export class AbstractConnector extends ObservableV2<any> {
10
+ /**
11
+ * @param {Doc} ydoc
12
+ * @param {any} awareness
13
+ */
14
+ constructor(ydoc: Doc, awareness: any);
15
+ doc: Doc;
16
+ awareness: any;
17
+ }
18
+ import { ObservableV2 } from 'lib0/observable';
19
+ import { Doc } from '../internals.js';
20
+ //# sourceMappingURL=AbstractConnector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractConnector.d.ts","sourceRoot":"","sources":["../../../src/utils/AbstractConnector.js"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH;IACE;;;OAGG;IACH,kBAHW,GAAG,aACH,GAAG,EAMb;IAFC,SAAe;IACf,eAA0B;CAE7B;6BAxB4B,iBAAiB;oBAIvC,iBAAiB"}