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

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 +96 -91
  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
@@ -5,31 +5,32 @@
5
5
  /**
6
6
  * @module engine/view/textproxy
7
7
  */
8
- import TypeCheckable from './typecheckable.js';
8
+ import { ViewTypeCheckable } from './typecheckable.js';
9
9
  import { CKEditorError } from '@ckeditor/ckeditor5-utils';
10
10
  /**
11
- * TextProxy is a wrapper for substring of {@link module:engine/view/text~Text}. Instance of this class is created by
12
- * {@link module:engine/view/treewalker~TreeWalker} when only a part of {@link module:engine/view/text~Text} needs to be returned.
11
+ * ViewTextProxy is a wrapper for substring of {@link module:engine/view/text~ViewText}. Instance of this class is created by
12
+ * {@link module:engine/view/treewalker~ViewTreeWalker} when only a part of {@link module:engine/view/text~ViewText} needs to be returned.
13
13
  *
14
- * `TextProxy` has an API similar to {@link module:engine/view/text~Text Text} and allows to do most of the common tasks performed
14
+ * `ViewTextProxy` has an API similar to {@link module:engine/view/text~ViewText Text} and allows to do most of the common tasks performed
15
15
  * on view nodes.
16
16
  *
17
- * **Note:** Some `TextProxy` instances may represent whole text node, not just a part of it.
18
- * See {@link module:engine/view/textproxy~TextProxy#isPartial}.
17
+ * **Note:** Some `ViewTextProxy` instances may represent whole text node, not just a part of it.
18
+ * See {@link module:engine/view/textproxy~ViewTextProxy#isPartial}.
19
19
  *
20
- * **Note:** `TextProxy` is a readonly interface.
20
+ * **Note:** `ViewTextProxy` is a readonly interface.
21
21
  *
22
- * **Note:** `TextProxy` instances are created on the fly basing on the current state of parent {@link module:engine/view/text~Text}.
22
+ * **Note:** `ViewTextProxy` instances are created on the fly basing
23
+ * on the current state of parent {@link module:engine/view/text~ViewText}.
23
24
  * Because of this it is highly unrecommended to store references to `TextProxy instances because they might get
24
- * invalidated due to operations on Document. Also TextProxy is not a {@link module:engine/view/node~Node} so it cannot be
25
- * inserted as a child of {@link module:engine/view/element~Element}.
25
+ * invalidated due to operations on Document. Also ViewTextProxy is not a {@link module:engine/view/node~ViewNode} so it cannot be
26
+ * inserted as a child of {@link module:engine/view/element~ViewElement}.
26
27
  *
27
- * `TextProxy` instances are created by {@link module:engine/view/treewalker~TreeWalker view tree walker}. You should not need to create
28
- * an instance of this class by your own.
28
+ * `ViewTextProxy` instances are created by {@link module:engine/view/treewalker~ViewTreeWalker view tree walker}.
29
+ * You should not need to create an instance of this class by your own.
29
30
  */
30
- export default class TextProxy extends TypeCheckable {
31
+ export class ViewTextProxy extends ViewTypeCheckable {
31
32
  /**
32
- * Reference to the {@link module:engine/view/text~Text} element which TextProxy is a substring.
33
+ * Reference to the {@link module:engine/view/text~ViewText} element which ViewTextProxy is a substring.
33
34
  */
34
35
  textNode;
35
36
  /**
@@ -37,7 +38,7 @@ export default class TextProxy extends TypeCheckable {
37
38
  */
38
39
  data;
39
40
  /**
40
- * Offset in the `textNode` where this `TextProxy` instance starts.
41
+ * Offset in the `textNode` where this `ViewTextProxy` instance starts.
41
42
  */
42
43
  offsetInText;
43
44
  /**
@@ -45,7 +46,7 @@ export default class TextProxy extends TypeCheckable {
45
46
  *
46
47
  * @internal
47
48
  * @param textNode Text node which part is represented by this text proxy.
48
- * @param offsetInText Offset in {@link module:engine/view/textproxy~TextProxy#textNode text node}
49
+ * @param offsetInText Offset in {@link module:engine/view/textproxy~ViewTextProxy#textNode text node}
49
50
  * from which the text proxy starts.
50
51
  * @param length Text proxy length, that is how many text node's characters, starting from `offsetInText` it represents.
51
52
  */
@@ -78,11 +79,11 @@ export default class TextProxy extends TypeCheckable {
78
79
  return this.data.length;
79
80
  }
80
81
  /**
81
- * Flag indicating whether `TextProxy` instance covers only part of the original {@link module:engine/view/text~Text text node}
82
+ * Flag indicating whether `ViewTextProxy` instance covers only part of the original {@link module:engine/view/text~ViewText text node}
82
83
  * (`true`) or the whole text node (`false`).
83
84
  *
84
- * This is `false` when text proxy starts at the very beginning of {@link module:engine/view/textproxy~TextProxy#textNode textNode}
85
- * ({@link module:engine/view/textproxy~TextProxy#offsetInText offsetInText} equals `0`) and text proxy sizes is equal to
85
+ * This is `false` when text proxy starts at the very beginning of {@link module:engine/view/textproxy~ViewTextProxy#textNode textNode}
86
+ * ({@link module:engine/view/textproxy~ViewTextProxy#offsetInText offsetInText} equals `0`) and text proxy sizes is equal to
86
87
  * text node size.
87
88
  */
88
89
  get isPartial() {
@@ -101,8 +102,8 @@ export default class TextProxy extends TypeCheckable {
101
102
  return this.textNode.root;
102
103
  }
103
104
  /**
104
- * {@link module:engine/view/document~Document View document} that owns this text proxy, or `null` if the text proxy is inside
105
- * {@link module:engine/view/documentfragment~DocumentFragment document fragment}.
105
+ * {@link module:engine/view/document~ViewDocument View document} that owns this text proxy, or `null` if the text proxy is inside
106
+ * {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}.
106
107
  */
107
108
  get document() {
108
109
  return this.textNode.document;
@@ -128,7 +129,7 @@ export default class TextProxy extends TypeCheckable {
128
129
  }
129
130
  // The magic of type inference using `is` method is centralized in `TypeCheckable` class.
130
131
  // Proper overload would interfere with that.
131
- TextProxy.prototype.is = function (type) {
132
+ ViewTextProxy.prototype.is = function (type) {
132
133
  return type === '$textProxy' || type === 'view:$textProxy' ||
133
134
  // This are legacy values kept for backward compatibility.
134
135
  type === 'textProxy' || type === 'view:textProxy';
@@ -6,11 +6,11 @@
6
6
  * @module engine/view/tokenlist
7
7
  */
8
8
  import { type ArrayOrItem } from '@ckeditor/ckeditor5-utils';
9
- import type { ElementAttributeValue } from './element.js';
9
+ import type { ViewElementAttributeValue } from './element.js';
10
10
  /**
11
11
  * Token list. Allows handling (adding, removing, retrieving) a set of tokens (for example class names).
12
12
  */
13
- export default class TokenList implements ElementAttributeValue {
13
+ export declare class ViewTokenList implements ViewElementAttributeValue {
14
14
  /**
15
15
  * The set of tokens.
16
16
  */
@@ -54,7 +54,7 @@ export default class TokenList implements ElementAttributeValue {
54
54
  /**
55
55
  * Returns `true` if both attributes have the same tokens.
56
56
  */
57
- isSimilar(other: TokenList): boolean;
57
+ isSimilar(other: ViewTokenList): boolean;
58
58
  /**
59
59
  * Clones the attribute value.
60
60
  *
@@ -78,32 +78,32 @@ export default class TokenList implements ElementAttributeValue {
78
78
  */
79
79
  _getConsumables(name?: string): Array<string>;
80
80
  /**
81
- * Used by {@link module:engine/view/element~Element#_canMergeAttributesFrom} to verify if the given attribute
81
+ * Used by {@link module:engine/view/element~ViewElement#_canMergeAttributesFrom} to verify if the given attribute
82
82
  * can be merged without conflicts into the attribute.
83
83
  *
84
- * This method is indirectly used by the {@link module:engine/view/downcastwriter~DowncastWriter} while downcasting
85
- * an {@link module:engine/view/attributeelement~AttributeElement} to merge it with other `AttributeElement`.
84
+ * This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while downcasting
85
+ * an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other `AttributeElement`.
86
86
  *
87
87
  * @internal
88
88
  */
89
89
  _canMergeFrom(): boolean;
90
90
  /**
91
- * Used by {@link module:engine/view/element~Element#_mergeAttributesFrom} to merge a given attribute into the attribute.
91
+ * Used by {@link module:engine/view/element~ViewElement#_mergeAttributesFrom} to merge a given attribute into the attribute.
92
92
  *
93
- * This method is indirectly used by the {@link module:engine/view/downcastwriter~DowncastWriter} while down-casting
94
- * an {@link module:engine/view/attributeelement~AttributeElement} to merge it with other AttributeElement.
93
+ * This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
94
+ * an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.
95
95
  *
96
96
  * @internal
97
97
  */
98
- _mergeFrom(other: TokenList): void;
98
+ _mergeFrom(other: ViewTokenList): void;
99
99
  /**
100
- * Used by {@link module:engine/view/element~Element#_canSubtractAttributesOf} to verify if the given attribute
100
+ * Used by {@link module:engine/view/element~ViewElement#_canSubtractAttributesOf} to verify if the given attribute
101
101
  * can be fully subtracted from the attribute.
102
102
  *
103
- * This method is indirectly used by the {@link module:engine/view/downcastwriter~DowncastWriter} while down-casting
104
- * an {@link module:engine/view/attributeelement~AttributeElement} to unwrap the AttributeElement.
103
+ * This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
104
+ * an {@link module:engine/view/attributeelement~ViewAttributeElement} to unwrap the ViewAttributeElement.
105
105
  *
106
106
  * @internal
107
107
  */
108
- _isMatching(other: TokenList): boolean;
108
+ _isMatching(other: ViewTokenList): boolean;
109
109
  }
@@ -9,7 +9,7 @@ import { toArray } from '@ckeditor/ckeditor5-utils';
9
9
  /**
10
10
  * Token list. Allows handling (adding, removing, retrieving) a set of tokens (for example class names).
11
11
  */
12
- export default class TokenList {
12
+ export class ViewTokenList {
13
13
  /**
14
14
  * The set of tokens.
15
15
  */
@@ -148,11 +148,11 @@ export default class TokenList {
148
148
  return name ? [name] : this.keys();
149
149
  }
150
150
  /**
151
- * Used by {@link module:engine/view/element~Element#_canMergeAttributesFrom} to verify if the given attribute
151
+ * Used by {@link module:engine/view/element~ViewElement#_canMergeAttributesFrom} to verify if the given attribute
152
152
  * can be merged without conflicts into the attribute.
153
153
  *
154
- * This method is indirectly used by the {@link module:engine/view/downcastwriter~DowncastWriter} while downcasting
155
- * an {@link module:engine/view/attributeelement~AttributeElement} to merge it with other `AttributeElement`.
154
+ * This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while downcasting
155
+ * an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other `AttributeElement`.
156
156
  *
157
157
  * @internal
158
158
  */
@@ -160,10 +160,10 @@ export default class TokenList {
160
160
  return true;
161
161
  }
162
162
  /**
163
- * Used by {@link module:engine/view/element~Element#_mergeAttributesFrom} to merge a given attribute into the attribute.
163
+ * Used by {@link module:engine/view/element~ViewElement#_mergeAttributesFrom} to merge a given attribute into the attribute.
164
164
  *
165
- * This method is indirectly used by the {@link module:engine/view/downcastwriter~DowncastWriter} while down-casting
166
- * an {@link module:engine/view/attributeelement~AttributeElement} to merge it with other AttributeElement.
165
+ * This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
166
+ * an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.
167
167
  *
168
168
  * @internal
169
169
  */
@@ -175,11 +175,11 @@ export default class TokenList {
175
175
  }
176
176
  }
177
177
  /**
178
- * Used by {@link module:engine/view/element~Element#_canSubtractAttributesOf} to verify if the given attribute
178
+ * Used by {@link module:engine/view/element~ViewElement#_canSubtractAttributesOf} to verify if the given attribute
179
179
  * can be fully subtracted from the attribute.
180
180
  *
181
- * This method is indirectly used by the {@link module:engine/view/downcastwriter~DowncastWriter} while down-casting
182
- * an {@link module:engine/view/attributeelement~AttributeElement} to unwrap the AttributeElement.
181
+ * This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
182
+ * an {@link module:engine/view/attributeelement~ViewAttributeElement} to unwrap the ViewAttributeElement.
183
183
  *
184
184
  * @internal
185
185
  */
@@ -2,17 +2,17 @@
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 Position from './position.js';
6
- import type Item from './item.js';
7
- import type Range from './range.js';
5
+ import { ViewPosition } from './position.js';
6
+ import { type ViewItem } from './item.js';
7
+ import { type ViewRange } from './range.js';
8
8
  /**
9
9
  * Position iterator class. It allows to iterate forward and backward over the document.
10
10
  */
11
- export default class TreeWalker implements IterableIterator<TreeWalkerValue> {
11
+ export declare class ViewTreeWalker implements IterableIterator<ViewTreeWalkerValue> {
12
12
  /**
13
13
  * Walking direction. Defaults `'forward'`.
14
14
  */
15
- readonly direction: TreeWalkerDirection;
15
+ readonly direction: ViewTreeWalkerDirection;
16
16
  /**
17
17
  * Iterator boundaries.
18
18
  *
@@ -21,10 +21,10 @@ export default class TreeWalker implements IterableIterator<TreeWalkerValue> {
21
21
  *
22
22
  * If boundaries are not defined they are set before first and after last child of the root node.
23
23
  */
24
- readonly boundaries: Range | null;
24
+ readonly boundaries: ViewRange | null;
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
  readonly singleCharacters: boolean;
30
30
  /**
@@ -34,7 +34,7 @@ export default class TreeWalker implements IterableIterator<TreeWalkerValue> {
34
34
  readonly shallow: boolean;
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
  readonly ignoreElementEnd: boolean;
@@ -56,16 +56,16 @@ export default class TreeWalker implements IterableIterator<TreeWalkerValue> {
56
56
  *
57
57
  * @param options Object with configuration.
58
58
  */
59
- constructor(options?: TreeWalkerOptions);
59
+ constructor(options?: ViewTreeWalkerOptions);
60
60
  /**
61
61
  * Iterable interface.
62
62
  */
63
- [Symbol.iterator](): IterableIterator<TreeWalkerValue>;
63
+ [Symbol.iterator](): IterableIterator<ViewTreeWalkerValue>;
64
64
  /**
65
65
  * Iterator position. If start position is not defined then position depends on {@link #direction}. If direction is
66
66
  * `'forward'` position starts form the beginning, when direction is `'backward'` position starts from the end.
67
67
  */
68
- get position(): Position;
68
+ get position(): ViewPosition;
69
69
  /**
70
70
  * Moves {@link #position} in the {@link #direction} skipping values as long as the callback function returns `true`.
71
71
  *
@@ -77,17 +77,17 @@ export default class TreeWalker implements IterableIterator<TreeWalkerValue> {
77
77
  * walker.skip( value => false ); // Do not move the position.
78
78
  * ```
79
79
  *
80
- * @param skip Callback function. Gets {@link module:engine/view/treewalker~TreeWalkerValue} and should
80
+ * @param skip Callback function. Gets {@link module:engine/view/treewalker~ViewTreeWalkerValue} and should
81
81
  * return `true` if the value should be skipped or `false` if not.
82
82
  */
83
- skip(skip: (value: TreeWalkerValue) => boolean): void;
83
+ skip(skip: (value: ViewTreeWalkerValue) => boolean): void;
84
84
  /**
85
85
  * Moves tree walker {@link #position} to provided `position`. Tree walker will
86
86
  * continue traversing from that position.
87
87
  *
88
- * Note: in contrary to {@link ~TreeWalker#skip}, this method does not iterate over the nodes along the way.
88
+ * Note: in contrary to {@link ~ViewTreeWalker#skip}, this method does not iterate over the nodes along the way.
89
89
  * It simply sets the current tree walker position to a new one.
90
- * From the performance standpoint, it is better to use {@link ~TreeWalker#jumpTo} rather than {@link ~TreeWalker#skip}.
90
+ * From the performance standpoint, it is better to use {@link ~ViewTreeWalker#jumpTo} rather than {@link ~ViewTreeWalker#skip}.
91
91
  *
92
92
  * If the provided position is before the start boundary, the position will be
93
93
  * set to the start boundary. If the provided position is after the end boundary,
@@ -96,14 +96,14 @@ export default class TreeWalker implements IterableIterator<TreeWalkerValue> {
96
96
  *
97
97
  * @param position Position to jump to.
98
98
  */
99
- jumpTo(position: Position): void;
99
+ jumpTo(position: ViewPosition): void;
100
100
  /**
101
101
  * Gets the next tree walker's value.
102
102
  *
103
103
  * @returns Object implementing iterator interface, returning
104
104
  * information about taken step.
105
105
  */
106
- next(): IteratorResult<TreeWalkerValue, undefined>;
106
+ next(): IteratorResult<ViewTreeWalkerValue, undefined>;
107
107
  /**
108
108
  * Makes a step forward in view. Moves the {@link #position} to the next position and returns the encountered value.
109
109
  */
@@ -113,7 +113,8 @@ export default class TreeWalker implements IterableIterator<TreeWalkerValue> {
113
113
  */
114
114
  private _previous;
115
115
  /**
116
- * Format returned data and adjust `previousPosition` and `nextPosition` if reach the bound of the {@link module:engine/view/text~Text}.
116
+ * Format returned data and adjust `previousPosition` and `nextPosition` if
117
+ * reach the bound of the {@link module:engine/view/text~ViewText}.
117
118
  *
118
119
  * @param type Type of step.
119
120
  * @param item Item between old and new position.
@@ -124,44 +125,44 @@ export default class TreeWalker implements IterableIterator<TreeWalkerValue> {
124
125
  private _formatReturnValue;
125
126
  }
126
127
  /**
127
- * Type of the step made by {@link module:engine/view/treewalker~TreeWalker}.
128
+ * Type of the step made by {@link module:engine/view/treewalker~ViewTreeWalker}.
128
129
  * Possible values: `'elementStart'` if walker is at the beginning of a node, `'elementEnd'` if walker is at the end
129
130
  * of node, or `'text'` if walker traversed over single and multiple characters.
130
- * For {@link module:engine/view/text~Text} `elementStart` and `elementEnd` is not returned.
131
+ * For {@link module:engine/view/text~ViewText} `elementStart` and `elementEnd` is not returned.
131
132
  */
132
- export type TreeWalkerValueType = 'elementStart' | 'elementEnd' | 'text';
133
+ export type ViewTreeWalkerValueType = 'elementStart' | 'elementEnd' | 'text';
133
134
  /**
134
- * Object returned by {@link module:engine/view/treewalker~TreeWalker} when traversing tree view.
135
+ * Object returned by {@link module:engine/view/treewalker~ViewTreeWalker} when traversing tree view.
135
136
  */
136
- export interface TreeWalkerValue {
137
+ export interface ViewTreeWalkerValue {
137
138
  /**
138
- * Type of the step made by {@link module:engine/view/treewalker~TreeWalker}.
139
+ * Type of the step made by {@link module:engine/view/treewalker~ViewTreeWalker}.
139
140
  */
140
- type: TreeWalkerValueType;
141
+ type: ViewTreeWalkerValueType;
141
142
  /**
142
143
  * Item between the old and the new positions of the tree walker.
143
144
  */
144
- item: Item;
145
+ item: ViewItem;
145
146
  /**
146
147
  * Previous position of the iterator.
147
148
  * * Forward iteration: For `'elementEnd'` it is the last position inside the element. For all other types it is the
148
149
  * position before the item.
149
150
  * * Backward iteration: For `'elementStart'` it is the first position inside the element. For all other types it is
150
151
  * the position after item.
151
- * * If the position is at the beginning or at the end of the {@link module:engine/view/text~Text} it is always moved from the
152
+ * * If the position is at the beginning or at the end of the {@link module:engine/view/text~ViewText} it is always moved from the
152
153
  * inside of the text to its parent just before or just after that text.
153
154
  */
154
- previousPosition: Position;
155
+ previousPosition: ViewPosition;
155
156
  /**
156
157
  * Next position of the iterator.
157
158
  * * Forward iteration: For `'elementStart'` it is the first position inside the element. For all other types it is
158
159
  * the position after the item.
159
160
  * * Backward iteration: For `'elementEnd'` it is last position inside element. For all other types it is the position
160
161
  * before the item.
161
- * * If the position is at the beginning or at the end of the {@link module:engine/view/text~Text} it is always moved from the
162
+ * * If the position is at the beginning or at the end of the {@link module:engine/view/text~ViewText} it is always moved from the
162
163
  * inside of the text to its parent just before or just after that text.
163
164
  */
164
- nextPosition: Position;
165
+ nextPosition: ViewPosition;
165
166
  /**
166
167
  * Length of the item. For `'elementStart'` it is `1`. For `'text'` it is
167
168
  * the length of that text. For `'elementEnd'` it is `undefined`.
@@ -171,29 +172,30 @@ export interface TreeWalkerValue {
171
172
  /**
172
173
  * Tree walking direction.
173
174
  */
174
- export type TreeWalkerDirection = 'forward' | 'backward';
175
+ export type ViewTreeWalkerDirection = 'forward' | 'backward';
175
176
  /**
176
- * The configuration of {@link ~TreeWalker}.
177
+ * The configuration of {@link ~ViewTreeWalker}.
177
178
  */
178
- export interface TreeWalkerOptions {
179
+ export interface ViewTreeWalkerOptions {
179
180
  /**
180
181
  * Walking direction.
181
182
  *
182
183
  * @default 'forward'
183
184
  */
184
- direction?: TreeWalkerDirection;
185
+ direction?: ViewTreeWalkerDirection;
185
186
  /**
186
187
  * Range to define boundaries of the iterator.
187
188
  */
188
- boundaries?: Range | null;
189
+ boundaries?: ViewRange | null;
189
190
  /**
190
191
  * Starting position.
191
192
  */
192
- startPosition?: Position;
193
+ startPosition?: ViewPosition;
193
194
  /**
194
195
  * Flag indicating whether all characters from
195
- * {@link module:engine/view/text~Text} should be returned as one {@link module:engine/view/text~Text} (`false`) or one by one as
196
- * {@link module:engine/view/textproxy~TextProxy} (`true`).
196
+ * {@link module:engine/view/text~ViewText} should be returned as one
197
+ * {@link module:engine/view/text~ViewText} (`false`) or one by one as
198
+ * {@link module:engine/view/textproxy~ViewTextProxy} (`true`).
197
199
  */
198
200
  singleCharacters?: boolean;
199
201
  /**
@@ -204,7 +206,7 @@ export interface TreeWalkerOptions {
204
206
  /**
205
207
  * Flag indicating whether iterator should ignore `elementEnd`
206
208
  * tags. If the option is true walker will not return a parent node of start position. If this option is `true`
207
- * each {@link module:engine/view/element~Element} will be returned once, while if the option is `false` they might be returned
209
+ * each {@link module:engine/view/element~ViewElement} will be returned once, while if the option is `false` they might be returned
208
210
  * twice: for `'elementStart'` and `'elementEnd'`.
209
211
  */
210
212
  ignoreElementEnd?: boolean;