@ckeditor/ckeditor5-engine 45.2.1 → 46.0.0-alpha.0

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 (241) hide show
  1. package/dist/index.js +2563 -2257
  2. package/dist/index.js.map +1 -1
  3. package/package.json +3 -3
  4. package/src/controller/datacontroller.d.ts +33 -32
  5. package/src/controller/datacontroller.js +29 -28
  6. package/src/controller/editingcontroller.d.ts +8 -8
  7. package/src/controller/editingcontroller.js +10 -10
  8. package/src/conversion/conversion.d.ts +18 -19
  9. package/src/conversion/conversion.js +4 -4
  10. package/src/conversion/conversionhelpers.d.ts +1 -1
  11. package/src/conversion/conversionhelpers.js +1 -1
  12. package/src/conversion/downcastdispatcher.d.ts +63 -69
  13. package/src/conversion/downcastdispatcher.js +16 -16
  14. package/src/conversion/downcasthelpers.d.ts +94 -83
  15. package/src/conversion/downcasthelpers.js +63 -53
  16. package/src/conversion/mapper.d.ts +27 -27
  17. package/src/conversion/mapper.js +15 -15
  18. package/src/conversion/modelconsumable.d.ts +26 -26
  19. package/src/conversion/modelconsumable.js +23 -23
  20. package/src/conversion/upcastdispatcher.d.ts +33 -32
  21. package/src/conversion/upcastdispatcher.js +19 -19
  22. package/src/conversion/upcasthelpers.d.ts +46 -38
  23. package/src/conversion/upcasthelpers.js +33 -24
  24. package/src/conversion/viewconsumable.d.ts +50 -45
  25. package/src/conversion/viewconsumable.js +32 -27
  26. package/src/dataprocessor/basichtmlwriter.d.ts +4 -2
  27. package/src/dataprocessor/basichtmlwriter.js +3 -1
  28. package/src/dataprocessor/dataprocessor.d.ts +7 -6
  29. package/src/dataprocessor/htmldataprocessor.d.ts +10 -10
  30. package/src/dataprocessor/htmldataprocessor.js +6 -6
  31. package/src/dataprocessor/htmlwriter.d.ts +1 -1
  32. package/src/dataprocessor/xmldataprocessor.d.ts +10 -10
  33. package/src/dataprocessor/xmldataprocessor.js +6 -6
  34. package/src/dev-utils/model.d.ts +25 -26
  35. package/src/dev-utils/model.js +35 -36
  36. package/src/dev-utils/operationreplayer.d.ts +5 -3
  37. package/src/dev-utils/operationreplayer.js +4 -2
  38. package/src/dev-utils/utils.d.ts +8 -0
  39. package/src/dev-utils/utils.js +8 -0
  40. package/src/dev-utils/view.d.ts +66 -63
  41. package/src/dev-utils/view.js +144 -134
  42. package/src/index.d.ts +135 -106
  43. package/src/index.js +120 -71
  44. package/src/legacyerrors.d.ts +5 -0
  45. package/src/legacyerrors.js +17 -0
  46. package/src/model/batch.d.ts +2 -15
  47. package/src/model/batch.js +1 -23
  48. package/src/model/differ.d.ts +54 -31
  49. package/src/model/differ.js +15 -15
  50. package/src/model/document.d.ts +31 -31
  51. package/src/model/document.js +13 -13
  52. package/src/model/documentfragment.d.ts +45 -45
  53. package/src/model/documentfragment.js +40 -40
  54. package/src/model/documentselection.d.ts +92 -92
  55. package/src/model/documentselection.js +71 -70
  56. package/src/model/element.d.ts +31 -31
  57. package/src/model/element.js +29 -29
  58. package/src/model/history.d.ts +3 -3
  59. package/src/model/history.js +2 -2
  60. package/src/model/item.d.ts +4 -5
  61. package/src/model/liveposition.d.ts +31 -31
  62. package/src/model/liveposition.js +18 -18
  63. package/src/model/liverange.d.ts +42 -38
  64. package/src/model/liverange.js +17 -16
  65. package/src/model/markercollection.d.ts +41 -40
  66. package/src/model/markercollection.js +22 -20
  67. package/src/model/model.d.ts +82 -81
  68. package/src/model/model.js +54 -54
  69. package/src/model/node.d.ts +48 -48
  70. package/src/model/node.js +31 -31
  71. package/src/model/nodelist.d.ts +17 -17
  72. package/src/model/nodelist.js +11 -11
  73. package/src/model/operation/attributeoperation.d.ts +10 -10
  74. package/src/model/operation/attributeoperation.js +7 -7
  75. package/src/model/operation/detachoperation.d.ts +11 -9
  76. package/src/model/operation/detachoperation.js +8 -6
  77. package/src/model/operation/insertoperation.d.ts +13 -13
  78. package/src/model/operation/insertoperation.js +15 -15
  79. package/src/model/operation/markeroperation.d.ts +12 -12
  80. package/src/model/operation/markeroperation.js +5 -5
  81. package/src/model/operation/mergeoperation.d.ts +16 -16
  82. package/src/model/operation/mergeoperation.js +18 -18
  83. package/src/model/operation/moveoperation.d.ts +16 -16
  84. package/src/model/operation/moveoperation.js +18 -15
  85. package/src/model/operation/nooperation.d.ts +4 -4
  86. package/src/model/operation/nooperation.js +2 -2
  87. package/src/model/operation/operation.d.ts +10 -10
  88. package/src/model/operation/operation.js +5 -5
  89. package/src/model/operation/operationfactory.d.ts +4 -4
  90. package/src/model/operation/operationfactory.js +12 -12
  91. package/src/model/operation/renameoperation.d.ts +10 -10
  92. package/src/model/operation/renameoperation.js +7 -7
  93. package/src/model/operation/rootattributeoperation.d.ts +12 -12
  94. package/src/model/operation/rootattributeoperation.js +8 -8
  95. package/src/model/operation/rootoperation.d.ts +8 -8
  96. package/src/model/operation/rootoperation.js +3 -3
  97. package/src/model/operation/splitoperation.d.ts +17 -17
  98. package/src/model/operation/splitoperation.js +19 -19
  99. package/src/model/operation/transform.d.ts +11 -8
  100. package/src/model/operation/transform.js +66 -49
  101. package/src/model/operation/utils.d.ts +24 -23
  102. package/src/model/operation/utils.js +20 -20
  103. package/src/model/position.d.ts +101 -97
  104. package/src/model/position.js +69 -64
  105. package/src/model/range.d.ts +90 -90
  106. package/src/model/range.js +87 -87
  107. package/src/model/rootelement.d.ts +11 -11
  108. package/src/model/rootelement.js +9 -9
  109. package/src/model/schema.d.ts +158 -154
  110. package/src/model/schema.js +93 -90
  111. package/src/model/selection.d.ts +73 -73
  112. package/src/model/selection.js +62 -62
  113. package/src/model/text.d.ts +11 -10
  114. package/src/model/text.js +11 -10
  115. package/src/model/textproxy.d.ts +39 -38
  116. package/src/model/textproxy.js +31 -30
  117. package/src/model/treewalker.d.ts +37 -37
  118. package/src/model/treewalker.js +14 -14
  119. package/src/model/typecheckable.d.ts +45 -45
  120. package/src/model/typecheckable.js +1 -1
  121. package/src/model/utils/autoparagraphing.d.ts +7 -7
  122. package/src/model/utils/deletecontent.d.ts +7 -5
  123. package/src/model/utils/deletecontent.js +13 -11
  124. package/src/model/utils/getselectedcontent.d.ts +6 -5
  125. package/src/model/utils/getselectedcontent.js +2 -1
  126. package/src/model/utils/insertcontent.d.ts +9 -8
  127. package/src/model/utils/insertcontent.js +41 -40
  128. package/src/model/utils/insertobject.d.ts +9 -9
  129. package/src/model/utils/insertobject.js +4 -4
  130. package/src/model/utils/modifyselection.d.ts +5 -4
  131. package/src/model/utils/modifyselection.js +12 -11
  132. package/src/model/utils/selection-post-fixer.d.ts +12 -8
  133. package/src/model/utils/selection-post-fixer.js +15 -11
  134. package/src/model/writer.d.ts +102 -101
  135. package/src/model/writer.js +99 -98
  136. package/src/view/attributeelement.d.ts +29 -29
  137. package/src/view/attributeelement.js +25 -25
  138. package/src/view/containerelement.d.ts +16 -15
  139. package/src/view/containerelement.js +15 -14
  140. package/src/view/datatransfer.d.ts +7 -7
  141. package/src/view/datatransfer.js +1 -1
  142. package/src/view/document.d.ts +25 -25
  143. package/src/view/document.js +15 -15
  144. package/src/view/documentfragment.d.ts +21 -21
  145. package/src/view/documentfragment.js +14 -14
  146. package/src/view/documentselection.d.ts +65 -63
  147. package/src/view/documentselection.js +27 -25
  148. package/src/view/domconverter.d.ts +94 -89
  149. package/src/view/domconverter.js +78 -73
  150. package/src/view/downcastwriter.d.ts +185 -181
  151. package/src/view/downcastwriter.js +222 -210
  152. package/src/view/editableelement.d.ts +13 -13
  153. package/src/view/editableelement.js +8 -8
  154. package/src/view/element.d.ts +75 -74
  155. package/src/view/element.js +58 -58
  156. package/src/view/elementdefinition.d.ts +3 -4
  157. package/src/view/emptyelement.d.ts +13 -13
  158. package/src/view/emptyelement.js +13 -13
  159. package/src/view/filler.d.ts +14 -3
  160. package/src/view/filler.js +12 -1
  161. package/src/view/item.d.ts +4 -5
  162. package/src/view/matcher.d.ts +22 -19
  163. package/src/view/matcher.js +6 -6
  164. package/src/view/node.d.ts +33 -33
  165. package/src/view/node.js +9 -9
  166. package/src/view/observer/arrowkeysobserver.d.ts +10 -10
  167. package/src/view/observer/arrowkeysobserver.js +5 -5
  168. package/src/view/observer/bubblingemittermixin.d.ts +5 -5
  169. package/src/view/observer/bubblingemittermixin.js +2 -9
  170. package/src/view/observer/bubblingeventinfo.d.ts +9 -9
  171. package/src/view/observer/bubblingeventinfo.js +1 -1
  172. package/src/view/observer/clickobserver.d.ts +8 -8
  173. package/src/view/observer/clickobserver.js +4 -4
  174. package/src/view/observer/compositionobserver.d.ts +19 -19
  175. package/src/view/observer/compositionobserver.js +6 -6
  176. package/src/view/observer/domeventdata.d.ts +9 -9
  177. package/src/view/observer/domeventdata.js +2 -2
  178. package/src/view/observer/domeventobserver.d.ts +3 -3
  179. package/src/view/observer/domeventobserver.js +5 -5
  180. package/src/view/observer/fakeselectionobserver.d.ts +9 -9
  181. package/src/view/observer/fakeselectionobserver.js +8 -8
  182. package/src/view/observer/focusobserver.d.ts +16 -16
  183. package/src/view/observer/focusobserver.js +7 -7
  184. package/src/view/observer/inputobserver.d.ts +18 -18
  185. package/src/view/observer/inputobserver.js +5 -5
  186. package/src/view/observer/keyobserver.d.ts +11 -11
  187. package/src/view/observer/keyobserver.js +3 -3
  188. package/src/view/observer/mouseobserver.d.ts +16 -16
  189. package/src/view/observer/mouseobserver.js +3 -3
  190. package/src/view/observer/mutationobserver.d.ts +21 -21
  191. package/src/view/observer/mutationobserver.js +7 -7
  192. package/src/view/observer/observer.d.ts +12 -12
  193. package/src/view/observer/observer.js +6 -6
  194. package/src/view/observer/selectionobserver.d.ts +33 -33
  195. package/src/view/observer/selectionobserver.js +14 -14
  196. package/src/view/observer/tabobserver.d.ts +10 -10
  197. package/src/view/observer/tabobserver.js +5 -5
  198. package/src/view/observer/touchobserver.d.ts +13 -13
  199. package/src/view/observer/touchobserver.js +3 -3
  200. package/src/view/placeholder.d.ts +21 -21
  201. package/src/view/placeholder.js +23 -23
  202. package/src/view/position.d.ts +49 -49
  203. package/src/view/position.js +42 -42
  204. package/src/view/range.d.ts +76 -74
  205. package/src/view/range.js +67 -65
  206. package/src/view/rawelement.d.ts +19 -19
  207. package/src/view/rawelement.js +16 -16
  208. package/src/view/renderer.d.ts +14 -14
  209. package/src/view/renderer.js +7 -7
  210. package/src/view/rooteditableelement.d.ts +8 -7
  211. package/src/view/rooteditableelement.js +7 -6
  212. package/src/view/selection.d.ts +66 -64
  213. package/src/view/selection.js +50 -48
  214. package/src/view/styles/background.d.ts +2 -2
  215. package/src/view/styles/background.js +9 -9
  216. package/src/view/styles/border.d.ts +2 -2
  217. package/src/view/styles/border.js +13 -13
  218. package/src/view/styles/margin.d.ts +2 -2
  219. package/src/view/styles/margin.js +5 -5
  220. package/src/view/styles/padding.d.ts +2 -2
  221. package/src/view/styles/padding.js +5 -5
  222. package/src/view/styles/utils.d.ts +24 -24
  223. package/src/view/styles/utils.js +25 -25
  224. package/src/view/stylesmap.d.ts +28 -32
  225. package/src/view/stylesmap.js +52 -39
  226. package/src/view/text.d.ts +11 -11
  227. package/src/view/text.js +10 -10
  228. package/src/view/textproxy.d.ts +33 -32
  229. package/src/view/textproxy.js +23 -22
  230. package/src/view/tokenlist.d.ts +14 -14
  231. package/src/view/tokenlist.js +10 -10
  232. package/src/view/treewalker.d.ts +42 -40
  233. package/src/view/treewalker.js +36 -35
  234. package/src/view/typecheckable.d.ts +76 -75
  235. package/src/view/typecheckable.js +1 -1
  236. package/src/view/uielement.d.ts +22 -21
  237. package/src/view/uielement.js +17 -16
  238. package/src/view/upcastwriter.d.ts +70 -70
  239. package/src/view/upcastwriter.js +42 -42
  240. package/src/view/view.d.ts +70 -69
  241. package/src/view/view.js +56 -55
@@ -2,13 +2,13 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- import TextProxy from './textproxy.js';
6
- import Position from './position.js';
5
+ import { ViewTextProxy } from './textproxy.js';
6
+ import { ViewPosition } from './position.js';
7
7
  import { CKEditorError } from '@ckeditor/ckeditor5-utils';
8
8
  /**
9
9
  * Position iterator class. It allows to iterate forward and backward over the document.
10
10
  */
11
- export default class TreeWalker {
11
+ export class ViewTreeWalker {
12
12
  /**
13
13
  * Walking direction. Defaults `'forward'`.
14
14
  */
@@ -23,8 +23,8 @@ export default class TreeWalker {
23
23
  */
24
24
  boundaries;
25
25
  /**
26
- * Flag indicating whether all characters from {@link module:engine/view/text~Text} should be returned as one
27
- * {@link module:engine/view/text~Text} or one by one as {@link module:engine/view/textproxy~TextProxy}.
26
+ * Flag indicating whether all characters from {@link module:engine/view/text~ViewText} should be returned as one
27
+ * {@link module:engine/view/text~ViewText} or one by one as {@link module:engine/view/textproxy~ViewTextProxy}.
28
28
  */
29
29
  singleCharacters;
30
30
  /**
@@ -34,7 +34,7 @@ export default class TreeWalker {
34
34
  shallow;
35
35
  /**
36
36
  * Flag indicating whether iterator should ignore `elementEnd` tags. If set to `true`, walker will not
37
- * return a parent node of the start position. Each {@link module:engine/view/element~Element} will be returned once.
37
+ * return a parent node of the start position. Each {@link module:engine/view/element~ViewElement} will be returned once.
38
38
  * When set to `false` each element might be returned twice: for `'elementStart'` and `'elementEnd'`.
39
39
  */
40
40
  ignoreElementEnd;
@@ -75,10 +75,10 @@ export default class TreeWalker {
75
75
  }
76
76
  this.boundaries = options.boundaries || null;
77
77
  if (options.startPosition) {
78
- this._position = Position._createAt(options.startPosition);
78
+ this._position = ViewPosition._createAt(options.startPosition);
79
79
  }
80
80
  else {
81
- this._position = Position._createAt(options.boundaries[options.direction == 'backward' ? 'end' : 'start']);
81
+ this._position = ViewPosition._createAt(options.boundaries[options.direction == 'backward' ? 'end' : 'start']);
82
82
  }
83
83
  this.direction = options.direction || 'forward';
84
84
  this.singleCharacters = !!options.singleCharacters;
@@ -111,7 +111,7 @@ export default class TreeWalker {
111
111
  * walker.skip( value => false ); // Do not move the position.
112
112
  * ```
113
113
  *
114
- * @param skip Callback function. Gets {@link module:engine/view/treewalker~TreeWalkerValue} and should
114
+ * @param skip Callback function. Gets {@link module:engine/view/treewalker~ViewTreeWalkerValue} and should
115
115
  * return `true` if the value should be skipped or `false` if not.
116
116
  */
117
117
  skip(skip) {
@@ -129,9 +129,9 @@ export default class TreeWalker {
129
129
  * Moves tree walker {@link #position} to provided `position`. Tree walker will
130
130
  * continue traversing from that position.
131
131
  *
132
- * Note: in contrary to {@link ~TreeWalker#skip}, this method does not iterate over the nodes along the way.
132
+ * Note: in contrary to {@link ~ViewTreeWalker#skip}, this method does not iterate over the nodes along the way.
133
133
  * It simply sets the current tree walker position to a new one.
134
- * From the performance standpoint, it is better to use {@link ~TreeWalker#jumpTo} rather than {@link ~TreeWalker#skip}.
134
+ * From the performance standpoint, it is better to use {@link ~ViewTreeWalker#jumpTo} rather than {@link ~ViewTreeWalker#skip}.
135
135
  *
136
136
  * If the provided position is before the start boundary, the position will be
137
137
  * set to the start boundary. If the provided position is after the end boundary,
@@ -184,7 +184,7 @@ export default class TreeWalker {
184
184
  if (parent && parent.is('view:$text')) {
185
185
  if (position.isAtEnd) {
186
186
  // Prevent returning "elementEnd" for Text node. Skip that value and return the next walker step.
187
- this._position = Position._createAfter(parent);
187
+ this._position = ViewPosition._createAfter(parent);
188
188
  return this._next();
189
189
  }
190
190
  node = parent.data[position.offset];
@@ -202,14 +202,14 @@ export default class TreeWalker {
202
202
  const endOffset = parent === this._boundaryEndParent ? this.boundaries.end.offset : parent.data.length;
203
203
  textLength = endOffset - position.offset;
204
204
  }
205
- const textProxy = new TextProxy(parent, position.offset, textLength);
205
+ const textProxy = new ViewTextProxy(parent, position.offset, textLength);
206
206
  position.offset += textLength;
207
207
  this._position = position;
208
208
  return this._formatReturnValue('text', textProxy, previousPosition, position, textLength);
209
209
  }
210
210
  if (node && node.is('view:element')) {
211
211
  if (!this.shallow) {
212
- position = new Position(node, 0);
212
+ position = new ViewPosition(node, 0);
213
213
  }
214
214
  else {
215
215
  // We are past the walker boundaries.
@@ -223,20 +223,20 @@ export default class TreeWalker {
223
223
  }
224
224
  if (node && node.is('view:$text')) {
225
225
  if (this.singleCharacters) {
226
- position = new Position(node, 0);
226
+ position = new ViewPosition(node, 0);
227
227
  this._position = position;
228
228
  return this._next();
229
229
  }
230
230
  let charactersCount = node.data.length;
231
231
  let item;
232
- // If text stick out of walker range, we need to cut it and wrap in TextProxy.
232
+ // If text stick out of walker range, we need to cut it and wrap in ViewTextProxy.
233
233
  if (node == this._boundaryEndParent) {
234
234
  charactersCount = this.boundaries.end.offset;
235
- item = new TextProxy(node, 0, charactersCount);
236
- position = Position._createAfter(item);
235
+ item = new ViewTextProxy(node, 0, charactersCount);
236
+ position = ViewPosition._createAfter(item);
237
237
  }
238
238
  else {
239
- item = new TextProxy(node, 0, node.data.length);
239
+ item = new ViewTextProxy(node, 0, node.data.length);
240
240
  // If not just keep moving forward.
241
241
  position.offset++;
242
242
  }
@@ -244,7 +244,7 @@ export default class TreeWalker {
244
244
  return this._formatReturnValue('text', item, previousPosition, position, charactersCount);
245
245
  }
246
246
  // `node` is not set, we reached the end of current `parent`.
247
- position = Position._createAfter(parent);
247
+ position = ViewPosition._createAfter(parent);
248
248
  this._position = position;
249
249
  if (this.ignoreElementEnd) {
250
250
  return this._next();
@@ -268,11 +268,11 @@ export default class TreeWalker {
268
268
  }
269
269
  // Get node just before current position.
270
270
  let node;
271
- // Text {@link module:engine/view/text~Text} element is a specific parent because contains string instead of child nodes.
271
+ // Text {@link module:engine/view/text~ViewText} element is a specific parent because contains string instead of child nodes.
272
272
  if (parent.is('view:$text')) {
273
273
  if (position.isAtStart) {
274
274
  // Prevent returning "elementStart" for Text node. Skip that value and return the next walker step.
275
- this._position = Position._createBefore(parent);
275
+ this._position = ViewPosition._createBefore(parent);
276
276
  return this._previous();
277
277
  }
278
278
  node = parent.data[position.offset - 1];
@@ -291,7 +291,7 @@ export default class TreeWalker {
291
291
  textLength = 1;
292
292
  }
293
293
  position.offset -= textLength;
294
- const textProxy = new TextProxy(parent, position.offset, textLength);
294
+ const textProxy = new ViewTextProxy(parent, position.offset, textLength);
295
295
  this._position = position;
296
296
  return this._formatReturnValue('text', textProxy, previousPosition, position, textLength);
297
297
  }
@@ -301,7 +301,7 @@ export default class TreeWalker {
301
301
  this._position = position;
302
302
  return this._formatReturnValue('elementStart', node, previousPosition, position, 1);
303
303
  }
304
- position = new Position(node, node.childCount);
304
+ position = new ViewPosition(node, node.childCount);
305
305
  this._position = position;
306
306
  if (this.ignoreElementEnd) {
307
307
  return this._previous();
@@ -310,21 +310,21 @@ export default class TreeWalker {
310
310
  }
311
311
  if (node && node.is('view:$text')) {
312
312
  if (this.singleCharacters) {
313
- position = new Position(node, node.data.length);
313
+ position = new ViewPosition(node, node.data.length);
314
314
  this._position = position;
315
315
  return this._previous();
316
316
  }
317
317
  let charactersCount = node.data.length;
318
318
  let item;
319
- // If text stick out of walker range, we need to cut it and wrap in TextProxy.
319
+ // If text stick out of walker range, we need to cut it and wrap in ViewTextProxy.
320
320
  if (node == this._boundaryStartParent) {
321
321
  const offset = this.boundaries.start.offset;
322
- item = new TextProxy(node, offset, node.data.length - offset);
322
+ item = new ViewTextProxy(node, offset, node.data.length - offset);
323
323
  charactersCount = item.data.length;
324
- position = Position._createBefore(item);
324
+ position = ViewPosition._createBefore(item);
325
325
  }
326
326
  else {
327
- item = new TextProxy(node, 0, node.data.length);
327
+ item = new ViewTextProxy(node, 0, node.data.length);
328
328
  // If not just keep moving backward.
329
329
  position.offset--;
330
330
  }
@@ -332,12 +332,13 @@ export default class TreeWalker {
332
332
  return this._formatReturnValue('text', item, previousPosition, position, charactersCount);
333
333
  }
334
334
  // `node` is not set, we reached the beginning of current `parent`.
335
- position = Position._createBefore(parent);
335
+ position = ViewPosition._createBefore(parent);
336
336
  this._position = position;
337
337
  return this._formatReturnValue('elementStart', parent, previousPosition, position, 1);
338
338
  }
339
339
  /**
340
- * Format returned data and adjust `previousPosition` and `nextPosition` if reach the bound of the {@link module:engine/view/text~Text}.
340
+ * Format returned data and adjust `previousPosition` and `nextPosition` if
341
+ * reach the bound of the {@link module:engine/view/text~ViewText}.
341
342
  *
342
343
  * @param type Type of step.
343
344
  * @param item Item between old and new position.
@@ -354,23 +355,23 @@ export default class TreeWalker {
354
355
  // Position is at the end of Text.
355
356
  if (item.offsetInText + item.data.length == item.textNode.data.length) {
356
357
  if (this.direction == 'forward' && !(this.boundaries && this.boundaries.end.isEqual(this.position))) {
357
- nextPosition = Position._createAfter(item.textNode);
358
+ nextPosition = ViewPosition._createAfter(item.textNode);
358
359
  // When we change nextPosition of returned value we need also update walker current position.
359
360
  this._position = nextPosition;
360
361
  }
361
362
  else {
362
- previousPosition = Position._createAfter(item.textNode);
363
+ previousPosition = ViewPosition._createAfter(item.textNode);
363
364
  }
364
365
  }
365
366
  // Position is at the begining ot the text.
366
367
  if (item.offsetInText === 0) {
367
368
  if (this.direction == 'backward' && !(this.boundaries && this.boundaries.start.isEqual(this.position))) {
368
- nextPosition = Position._createBefore(item.textNode);
369
+ nextPosition = ViewPosition._createBefore(item.textNode);
369
370
  // When we change nextPosition of returned value we need also update walker current position.
370
371
  this._position = nextPosition;
371
372
  }
372
373
  else {
373
- previousPosition = Position._createBefore(item.textNode);
374
+ previousPosition = ViewPosition._createBefore(item.textNode);
374
375
  }
375
376
  }
376
377
  }
@@ -2,31 +2,31 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- import type AttributeElement from './attributeelement.js';
6
- import type ContainerElement from './containerelement.js';
7
- import type DocumentFragment from './documentfragment.js';
8
- import type DocumentSelection from './documentselection.js';
9
- import type EditableElement from './editableelement.js';
10
- import type Element from './element.js';
11
- import type EmptyElement from './emptyelement.js';
12
- import type Node from './node.js';
13
- import type Position from './position.js';
14
- import type Range from './range.js';
15
- import type RawElement from './rawelement.js';
16
- import type RootEditableElement from './rooteditableelement.js';
17
- import type Selection from './selection.js';
18
- import type Text from './text.js';
19
- import type TextProxy from './textproxy.js';
20
- import type UIElement from './uielement.js';
5
+ import { type ViewAttributeElement } from './attributeelement.js';
6
+ import { type ViewContainerElement } from './containerelement.js';
7
+ import { type ViewDocumentFragment } from './documentfragment.js';
8
+ import { type ViewDocumentSelection } from './documentselection.js';
9
+ import { type ViewEditableElement } from './editableelement.js';
10
+ import { type ViewElement } from './element.js';
11
+ import { type ViewEmptyElement } from './emptyelement.js';
12
+ import { type ViewNode } from './node.js';
13
+ import { type ViewPosition } from './position.js';
14
+ import { type ViewRange } from './range.js';
15
+ import { type ViewRawElement } from './rawelement.js';
16
+ import { type ViewRootEditableElement } from './rooteditableelement.js';
17
+ import { type ViewSelection } from './selection.js';
18
+ import { type ViewText } from './text.js';
19
+ import { type ViewTextProxy } from './textproxy.js';
20
+ import { type ViewUIElement } from './uielement.js';
21
21
  /**
22
22
  * @module engine/view/typecheckable
23
23
  */
24
- export default abstract class TypeCheckable {
24
+ export declare abstract class ViewTypeCheckable {
25
25
  /**
26
- * Checks whether this object is of type {@link module:engine/view/node~Node} or its subclass.
26
+ * Checks whether this object is of type {@link module:engine/view/node~ViewNode} or its subclass.
27
27
  *
28
28
  * This method is useful when processing view objects that are of unknown type. For example, a function
29
- * may return a {@link module:engine/view/documentfragment~DocumentFragment} or a {@link module:engine/view/node~Node}
29
+ * may return a {@link module:engine/view/documentfragment~ViewDocumentFragment} or a {@link module:engine/view/node~ViewNode}
30
30
  * that can be either a text node or an element. This method can be used to check what kind of object is returned.
31
31
  *
32
32
  * ```ts
@@ -51,9 +51,9 @@ export default abstract class TypeCheckable {
51
51
  * ```
52
52
  * @label NODE
53
53
  */
54
- is(type: 'node' | 'view:node'): this is (Node | Text | Element | AttributeElement | ContainerElement | EditableElement | EmptyElement | RawElement | RootEditableElement | UIElement);
54
+ is(type: 'node' | 'view:node'): this is (ViewNode | ViewText | ViewElement | ViewAttributeElement | ViewContainerElement | ViewEditableElement | ViewEmptyElement | ViewRawElement | ViewRootEditableElement | ViewUIElement);
55
55
  /**
56
- * Checks whether this object is of type {@link module:engine/view/element~Element} or its subclass.
56
+ * Checks whether this object is of type {@link module:engine/view/element~ViewElement} or its subclass.
57
57
  *
58
58
  * ```ts
59
59
  * element.is( 'element' ); // -> true
@@ -66,7 +66,7 @@ export default abstract class TypeCheckable {
66
66
  * ```
67
67
  *
68
68
  * Assuming that the object being checked is an element, you can also check its
69
- * {@link module:engine/view/element~Element#name name}:
69
+ * {@link module:engine/view/element~ViewElement#name name}:
70
70
  *
71
71
  * ```ts
72
72
  * element.is( 'element', 'img' ); // -> true if this is an <img> element
@@ -75,9 +75,9 @@ export default abstract class TypeCheckable {
75
75
  *
76
76
  * @label ELEMENT
77
77
  */
78
- is(type: 'element' | 'view:element'): this is (Element | AttributeElement | ContainerElement | EditableElement | EmptyElement | RawElement | RootEditableElement | UIElement);
78
+ is(type: 'element' | 'view:element'): this is (ViewElement | ViewAttributeElement | ViewContainerElement | ViewEditableElement | ViewEmptyElement | ViewRawElement | ViewRootEditableElement | ViewUIElement);
79
79
  /**
80
- * Checks whether this object is of type {@link module:engine/view/attributeelement~AttributeElement}.
80
+ * Checks whether this object is of type {@link module:engine/view/attributeelement~ViewAttributeElement}.
81
81
  *
82
82
  * ```ts
83
83
  * attributeElement.is( 'attributeElement' ); // -> true
@@ -92,7 +92,7 @@ export default abstract class TypeCheckable {
92
92
  * ```
93
93
  *
94
94
  * Assuming that the object being checked is an attribute element, you can also check its
95
- * {@link module:engine/view/attributeelement~AttributeElement#name name}:
95
+ * {@link module:engine/view/attributeelement~ViewAttributeElement#name name}:
96
96
  *
97
97
  * ```ts
98
98
  * attributeElement.is( 'element', 'b' ); // -> true if this is a bold element
@@ -102,9 +102,9 @@ export default abstract class TypeCheckable {
102
102
  *
103
103
  * @label ATTRIBUTE_ELEMENT
104
104
  */
105
- is(type: 'attributeElement' | 'view:attributeElement'): this is AttributeElement;
105
+ is(type: 'attributeElement' | 'view:attributeElement'): this is ViewAttributeElement;
106
106
  /**
107
- * Checks whether this object is of type {@link module:engine/view/containerelement~ContainerElement} or its subclass.
107
+ * Checks whether this object is of type {@link module:engine/view/containerelement~ViewContainerElement} or its subclass.
108
108
  *
109
109
  * ```ts
110
110
  * containerElement.is( 'containerElement' ); // -> true
@@ -119,7 +119,7 @@ export default abstract class TypeCheckable {
119
119
  * ```
120
120
  *
121
121
  * Assuming that the object being checked is a container element, you can also check its
122
- * {@link module:engine/view/containerelement~ContainerElement#name name}:
122
+ * {@link module:engine/view/containerelement~ViewContainerElement#name name}:
123
123
  *
124
124
  * ```ts
125
125
  * containerElement.is( 'element', 'div' ); // -> true if this is a div container element
@@ -129,9 +129,9 @@ export default abstract class TypeCheckable {
129
129
  *
130
130
  * @label CONTAINER_ELEMENT
131
131
  */
132
- is(type: 'containerElement' | 'view:containerElement'): this is ContainerElement | EditableElement | RootEditableElement;
132
+ is(type: 'containerElement' | 'view:containerElement'): this is ViewContainerElement | ViewEditableElement | ViewRootEditableElement;
133
133
  /**
134
- * Checks whether this object is of type {@link module:engine/view/editableelement~EditableElement} or its subclass.
134
+ * Checks whether this object is of type {@link module:engine/view/editableelement~ViewEditableElement} or its subclass.
135
135
  *
136
136
  * ```ts
137
137
  * editableElement.is( 'editableElement' ); // -> true
@@ -146,7 +146,7 @@ export default abstract class TypeCheckable {
146
146
  * ```
147
147
  *
148
148
  * Assuming that the object being checked is an editbale element, you can also check its
149
- * {@link module:engine/view/editableelement~EditableElement#name name}:
149
+ * {@link module:engine/view/editableelement~ViewEditableElement#name name}:
150
150
  *
151
151
  * ```ts
152
152
  * editableElement.is( 'element', 'div' ); // -> true if this is a div element
@@ -156,9 +156,9 @@ export default abstract class TypeCheckable {
156
156
  *
157
157
  * @label EDITABLE_ELEMENT
158
158
  */
159
- is(type: 'editableElement' | 'view:editableElement'): this is EditableElement | RootEditableElement;
159
+ is(type: 'editableElement' | 'view:editableElement'): this is ViewEditableElement | ViewRootEditableElement;
160
160
  /**
161
- * Checks whether this object is of type {@link module:engine/view/emptyelement~EmptyElement}.
161
+ * Checks whether this object is of type {@link module:engine/view/emptyelement~ViewEmptyElement}.
162
162
  *
163
163
  * ```ts
164
164
  * emptyElement.is( 'emptyElement' ); // -> true
@@ -173,7 +173,7 @@ export default abstract class TypeCheckable {
173
173
  * ```
174
174
  *
175
175
  * Assuming that the object being checked is an empty element, you can also check its
176
- * {@link module:engine/view/emptyelement~EmptyElement#name name}:
176
+ * {@link module:engine/view/emptyelement~ViewEmptyElement#name name}:
177
177
  *
178
178
  * ```ts
179
179
  * emptyElement.is( 'element', 'img' ); // -> true if this is a img element
@@ -183,9 +183,9 @@ export default abstract class TypeCheckable {
183
183
  *
184
184
  * @label EMPTY_ELEMENT
185
185
  */
186
- is(type: 'emptyElement' | 'view:emptyElement'): this is EmptyElement;
186
+ is(type: 'emptyElement' | 'view:emptyElement'): this is ViewEmptyElement;
187
187
  /**
188
- * Checks whether this object is of type {@link module:engine/view/rawelement~RawElement}.
188
+ * Checks whether this object is of type {@link module:engine/view/rawelement~ViewRawElement}.
189
189
  *
190
190
  * ```ts
191
191
  * rawElement.is( 'rawElement' ); // -> true
@@ -200,7 +200,7 @@ export default abstract class TypeCheckable {
200
200
  * ```
201
201
  *
202
202
  * Assuming that the object being checked is a raw element, you can also check its
203
- * {@link module:engine/view/rawelement~RawElement#name name}:
203
+ * {@link module:engine/view/rawelement~ViewRawElement#name name}:
204
204
  *
205
205
  * ```ts
206
206
  * rawElement.is( 'img' ); // -> true if this is an img element
@@ -210,9 +210,9 @@ export default abstract class TypeCheckable {
210
210
  *
211
211
  * @label RAW_ELEMENT
212
212
  */
213
- is(type: 'rawElement' | 'view:rawElement'): this is RawElement;
213
+ is(type: 'rawElement' | 'view:rawElement'): this is ViewRawElement;
214
214
  /**
215
- * Checks whether this object is of type {@link module:engine/view/rooteditableelement~RootEditableElement}.
215
+ * Checks whether this object is of type {@link module:engine/view/rooteditableelement~ViewRootEditableElement}.
216
216
  *
217
217
  * ```ts
218
218
  * rootEditableElement.is( 'rootElement' ); // -> true
@@ -228,7 +228,7 @@ export default abstract class TypeCheckable {
228
228
  * ```
229
229
  *
230
230
  * Assuming that the object being checked is a root editable element, you can also check its
231
- * {@link module:engine/view/rooteditableelement~RootEditableElement#name name}:
231
+ * {@link module:engine/view/rooteditableelement~ViewRootEditableElement#name name}:
232
232
  *
233
233
  * ```ts
234
234
  * rootEditableElement.is( 'element', 'div' ); // -> true if this is a div root editable element
@@ -238,9 +238,9 @@ export default abstract class TypeCheckable {
238
238
  *
239
239
  * @label ROOT_ELEMENT
240
240
  */
241
- is(type: 'rootElement' | 'view:rootElement'): this is RootEditableElement;
241
+ is(type: 'rootElement' | 'view:rootElement'): this is ViewRootEditableElement;
242
242
  /**
243
- * Checks whether this object is of type {@link module:engine/view/uielement~UIElement}.
243
+ * Checks whether this object is of type {@link module:engine/view/uielement~ViewUIElement}.
244
244
  *
245
245
  * ```ts
246
246
  * uiElement.is( 'uiElement' ); // -> true
@@ -255,7 +255,7 @@ export default abstract class TypeCheckable {
255
255
  * ```
256
256
  *
257
257
  * Assuming that the object being checked is an ui element, you can also check its
258
- * {@link module:engine/view/uielement~UIElement#name name}:
258
+ * {@link module:engine/view/uielement~ViewUIElement#name name}:
259
259
  *
260
260
  * ```ts
261
261
  * uiElement.is( 'element', 'span' ); // -> true if this is a span ui element
@@ -265,9 +265,9 @@ export default abstract class TypeCheckable {
265
265
  *
266
266
  * @label UI_ELEMENT
267
267
  */
268
- is(type: 'uiElement' | 'view:uiElement'): this is UIElement;
268
+ is(type: 'uiElement' | 'view:uiElement'): this is ViewUIElement;
269
269
  /**
270
- * Checks whether this object is of type {@link module:engine/view/text~Text}.
270
+ * Checks whether this object is of type {@link module:engine/view/text~ViewText}.
271
271
  *
272
272
  * ```ts
273
273
  * text.is( '$text' ); // -> true
@@ -282,9 +282,9 @@ export default abstract class TypeCheckable {
282
282
  *
283
283
  * @label TEXT
284
284
  */
285
- is(type: '$text' | 'view:$text'): this is Text;
285
+ is(type: '$text' | 'view:$text'): this is ViewText;
286
286
  /**
287
- * hecks whether this object is of type {@link module:engine/view/documentfragment~DocumentFragment}.
287
+ * hecks whether this object is of type {@link module:engine/view/documentfragment~ViewDocumentFragment}.
288
288
  *
289
289
  * ```ts
290
290
  * docFrag.is( 'documentFragment' ); // -> true
@@ -297,9 +297,9 @@ export default abstract class TypeCheckable {
297
297
  *
298
298
  * @label DOCUMENT_FRAGMENT
299
299
  */
300
- is(type: 'documentFragment' | 'view:documentFragment'): this is DocumentFragment;
300
+ is(type: 'documentFragment' | 'view:documentFragment'): this is ViewDocumentFragment;
301
301
  /**
302
- * Checks whether this object is of type {@link module:engine/view/textproxy~TextProxy}.
302
+ * Checks whether this object is of type {@link module:engine/view/textproxy~ViewTextProxy}.
303
303
  *
304
304
  * ```ts
305
305
  * textProxy.is( '$textProxy' ); // -> true
@@ -315,9 +315,9 @@ export default abstract class TypeCheckable {
315
315
  *
316
316
  * @label TEXT_PROXY
317
317
  */
318
- is(type: '$textProxy' | 'view:$textProxy'): this is TextProxy;
318
+ is(type: '$textProxy' | 'view:$textProxy'): this is ViewTextProxy;
319
319
  /**
320
- * Checks whether this object is of type {@link module:engine/view/position~Position}.
320
+ * Checks whether this object is of type {@link module:engine/view/position~ViewPosition}.
321
321
  *
322
322
  * ```ts
323
323
  * position.is( 'position' ); // -> true
@@ -330,9 +330,9 @@ export default abstract class TypeCheckable {
330
330
  *
331
331
  * @label POSITION
332
332
  */
333
- is(type: 'position' | 'view:position'): this is Position;
333
+ is(type: 'position' | 'view:position'): this is ViewPosition;
334
334
  /**
335
- * Checks whether this object is of type {@link module:engine/view/range~Range}.
335
+ * Checks whether this object is of type {@link module:engine/view/range~ViewRange}.
336
336
  *
337
337
  * ```ts
338
338
  * range.is( 'range' ); // -> true
@@ -345,10 +345,10 @@ export default abstract class TypeCheckable {
345
345
  *
346
346
  * @label RANGE
347
347
  */
348
- is(type: 'range' | 'view:range'): this is Range;
348
+ is(type: 'range' | 'view:range'): this is ViewRange;
349
349
  /**
350
- * Checks whether this object is of type {@link module:engine/view/selection~Selection} or
351
- * {@link module:engine/view/documentselection~DocumentSelection}.
350
+ * Checks whether this object is of type {@link module:engine/view/selection~ViewSelection} or
351
+ * {@link module:engine/view/documentselection~ViewDocumentSelection}.
352
352
  *
353
353
  * ```ts
354
354
  * selection.is( 'selection' ); // -> true
@@ -361,9 +361,9 @@ export default abstract class TypeCheckable {
361
361
  *
362
362
  * @label SELECTION
363
363
  */
364
- is(type: 'selection' | 'view:selection'): this is Selection | DocumentSelection;
364
+ is(type: 'selection' | 'view:selection'): this is ViewSelection | ViewDocumentSelection;
365
365
  /**
366
- * Checks whether this object is of type {@link module:engine/view/documentselection~DocumentSelection}.
366
+ * Checks whether this object is of type {@link module:engine/view/documentselection~ViewDocumentSelection}.
367
367
  *
368
368
  * ```ts
369
369
  * `docSelection.is( 'selection' ); // -> true
@@ -378,71 +378,72 @@ export default abstract class TypeCheckable {
378
378
  *
379
379
  * @label DOCUMENT_SELECTION
380
380
  */
381
- is(type: 'documentSelection' | 'view:documentSelection'): this is DocumentSelection;
381
+ is(type: 'documentSelection' | 'view:documentSelection'): this is ViewDocumentSelection;
382
382
  /**
383
- * Checks whether the object is of type {@link module:engine/view/element~Element} or its subclass and has the specified `name`.
383
+ * Checks whether the object is of type {@link module:engine/view/element~ViewElement} or its subclass and has the specified `name`.
384
384
  *
385
385
  * @label ELEMENT_NAME
386
386
  */
387
- is<N extends string>(type: 'element' | 'view:element', name: N): this is (Element | AttributeElement | ContainerElement | EditableElement | EmptyElement | RawElement | RootEditableElement | UIElement) & {
387
+ is<N extends string>(type: 'element' | 'view:element', name: N): this is (ViewElement | ViewAttributeElement | ViewContainerElement | ViewEditableElement | ViewEmptyElement | ViewRawElement | ViewRootEditableElement | ViewUIElement) & {
388
388
  name: N;
389
389
  };
390
390
  /**
391
- * Checks whether the object is of type {@link module:engine/view/attributeelement~AttributeElement} and has the specified `name`.
391
+ * Checks whether the object is of type {@link module:engine/view/attributeelement~ViewAttributeElement} and has the specified `name`.
392
392
  *
393
393
  * @label ATTRIBUTE_ELEMENT_NAME
394
394
  */
395
- is<N extends string>(type: 'attributeElement' | 'view:attributeElement', name: N): this is AttributeElement & {
395
+ is<N extends string>(type: 'attributeElement' | 'view:attributeElement', name: N): this is ViewAttributeElement & {
396
396
  name: N;
397
397
  };
398
398
  /**
399
- * Checks whether the object is of type {@link module:engine/view/containerelement~ContainerElement}
399
+ * Checks whether the object is of type {@link module:engine/view/containerelement~ViewContainerElement}
400
400
  * or its subclass and has the specified `name`.
401
401
  *
402
402
  * @label CONTAINER_ELEMENT_NAME
403
403
  */
404
- is<N extends string>(type: 'containerElement' | 'view:containerElement', name: N): this is (ContainerElement | EditableElement | RootEditableElement) & {
404
+ is<N extends string>(type: 'containerElement' | 'view:containerElement', name: N): this is (ViewContainerElement | ViewEditableElement | ViewRootEditableElement) & {
405
405
  name: N;
406
406
  };
407
407
  /**
408
- * Checks whether the object is of type {@link module:engine/view/editableelement~EditableElement}
408
+ * Checks whether the object is of type {@link module:engine/view/editableelement~ViewEditableElement}
409
409
  * or its subclass and has the specified `name`.
410
410
  *
411
411
  * @label EDITABLE_ELEMENT_NAME
412
412
  */
413
- is<N extends string>(type: 'editableElement' | 'view:editableElement', name: N): this is (EditableElement | RootEditableElement) & {
413
+ is<N extends string>(type: 'editableElement' | 'view:editableElement', name: N): this is (ViewEditableElement | ViewRootEditableElement) & {
414
414
  name: N;
415
415
  };
416
416
  /**
417
- * Checks whether the object is of type {@link module:engine/view/emptyelement~EmptyElement} has the specified `name`.
417
+ * Checks whether the object is of type {@link module:engine/view/emptyelement~ViewEmptyElement} has the specified `name`.
418
418
  *
419
419
  * @label EMPTY_ELEMENT_NAME
420
420
  */
421
- is<N extends string>(type: 'emptyElement' | 'view:emptyElement', name: N): this is EmptyElement & {
421
+ is<N extends string>(type: 'emptyElement' | 'view:emptyElement', name: N): this is ViewEmptyElement & {
422
422
  name: N;
423
423
  };
424
424
  /**
425
- * Checks whether the object is of type {@link module:engine/view/rawelement~RawElement} and has the specified `name`.
425
+ * Checks whether the object is of type {@link module:engine/view/rawelement~ViewRawElement} and has the specified `name`.
426
426
  *
427
427
  * @label RAW_ELEMENT_NAME
428
428
  */
429
- is<N extends string>(type: 'rawElement' | 'view:rawElement', name: N): this is RawElement & {
429
+ is<N extends string>(type: 'rawElement' | 'view:rawElement', name: N): this is ViewRawElement & {
430
430
  name: N;
431
431
  };
432
432
  /**
433
- * Checks whether the object is of type {@link module:engine/view/rooteditableelement~RootEditableElement} and has the specified `name`.
433
+ * Checks whether the object is of type {@link module:engine/view/rooteditableelement~ViewRootEditableElement}
434
+ * and has the specified `name`.
434
435
  *
435
436
  * @label ROOT_ELEMENT_NAME
436
437
  */
437
- is<N extends string>(type: 'rootElement' | 'view:rootElement', name: N): this is RootEditableElement & {
438
+ is<N extends string>(type: 'rootElement' | 'view:rootElement', name: N): this is ViewRootEditableElement & {
438
439
  name: N;
439
440
  };
440
441
  /**
441
- * Checks whether the object is of type {@link module:engine/view/uielement~UIElement} and has the specified `name`.
442
+ * Checks whether the object is of type {@link module:engine/view/uielement~ViewUIElement} and has the specified `name`.
442
443
  *
443
444
  * @label UI_ELEMENT_NAME
444
445
  */
445
- is<N extends string>(type: 'uiElement' | 'view:uiElement', name: N): this is UIElement & {
446
+ is<N extends string>(type: 'uiElement' | 'view:uiElement', name: N): this is ViewUIElement & {
446
447
  name: N;
447
448
  };
448
449
  }
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module engine/view/typecheckable
7
7
  */
8
- export default class TypeCheckable {
8
+ export class ViewTypeCheckable {
9
9
  /* istanbul ignore next -- @preserve */
10
10
  is() {
11
11
  // There are a lot of overloads above.