@ckeditor/ckeditor5-engine 45.2.1-alpha.9 → 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
@@ -5,39 +5,39 @@
5
5
  /**
6
6
  * @module engine/model/textproxy
7
7
  */
8
- import TypeCheckable from './typecheckable.js';
8
+ import { ModelTypeCheckable } from './typecheckable.js';
9
9
  import { CKEditorError } from '@ckeditor/ckeditor5-utils';
10
10
  // @if CK_DEBUG_ENGINE // const { convertMapToStringifiedObject } = require( '../dev-utils/utils' );
11
11
  /**
12
- * `TextProxy` represents a part of {@link module:engine/model/text~Text text node}.
12
+ * `ModelTextProxy` represents a part of {@link module:engine/model/text~ModelText text node}.
13
13
  *
14
- * Since {@link module:engine/model/position~Position positions} can be placed between characters of a text node,
15
- * {@link module:engine/model/range~Range ranges} may contain only parts of text nodes. When {@link module:engine/model/range~Range#getItems
16
- * getting items}
14
+ * Since {@link module:engine/model/position~ModelPosition positions} can be placed between characters of a text node,
15
+ * {@link module:engine/model/range~ModelRange ranges} may contain only parts of text nodes.
16
+ * When {@link module:engine/model/range~ModelRange#getItems getting items}
17
17
  * contained in such range, we need to represent a part of that text node, since returning the whole text node would be incorrect.
18
- * `TextProxy` solves this issue.
18
+ * `ModelTextProxy` solves this issue.
19
19
  *
20
- * `TextProxy` has an API similar to {@link module:engine/model/text~Text Text} and allows to do most of the common tasks performed
21
- * on model nodes.
20
+ * `ModelTextProxy` has an API similar to {@link module:engine/model/text~ModelText Text} and allows to do
21
+ * most of the common tasks performed on model nodes.
22
22
  *
23
- * **Note:** Some `TextProxy` instances may represent whole text node, not just a part of it.
24
- * See {@link module:engine/model/textproxy~TextProxy#isPartial}.
23
+ * **Note:** Some `ModelTextProxy` instances may represent whole text node, not just a part of it.
24
+ * See {@link module:engine/model/textproxy~ModelTextProxy#isPartial}.
25
25
  *
26
- * **Note:** `TextProxy` is not an instance of {@link module:engine/model/node~Node node}. Keep this in mind when using it as a
26
+ * **Note:** `ModelTextProxy` is not an instance of {@link module:engine/model/node~ModelNode node}. Keep this in mind when using it as a
27
27
  * parameter of methods.
28
28
  *
29
- * **Note:** `TextProxy` is a readonly interface. If you want to perform changes on model data represented by a `TextProxy`
30
- * use {@link module:engine/model/writer~Writer model writer API}.
29
+ * **Note:** `ModelTextProxy` is a readonly interface. If you want to perform changes on model data represented by a `ModelTextProxy`
30
+ * use {@link module:engine/model/writer~ModelWriter model writer API}.
31
31
  *
32
- * **Note:** `TextProxy` instances are created on the fly, basing on the current state of model. Because of this, it is
33
- * highly unrecommended to store references to `TextProxy` instances. `TextProxy` instances are not refreshed when
34
- * model changes, so they might get invalidated. Instead, consider creating {@link module:engine/model/liveposition~LivePosition live
32
+ * **Note:** `ModelTextProxy` instances are created on the fly, basing on the current state of model. Because of this, it is
33
+ * highly unrecommended to store references to `ModelTextProxy` instances. `ModelTextProxy` instances are not refreshed when
34
+ * model changes, so they might get invalidated. Instead, consider creating {@link module:engine/model/liveposition~ModelLivePosition live
35
35
  * position}.
36
36
  *
37
- * `TextProxy` instances are created by {@link module:engine/model/treewalker~TreeWalker model tree walker}. You should not need to create
38
- * an instance of this class by your own.
37
+ * `ModelTextProxy` instances are created by {@link module:engine/model/treewalker~ModelTreeWalker model tree walker}.
38
+ * You should not need to create an instance of this class by your own.
39
39
  */
40
- export default class TextProxy extends TypeCheckable {
40
+ export class ModelTextProxy extends ModelTypeCheckable {
41
41
  /**
42
42
  * Text node which part is represented by this text proxy.
43
43
  */
@@ -47,7 +47,7 @@ export default class TextProxy extends TypeCheckable {
47
47
  */
48
48
  data;
49
49
  /**
50
- * Offset in {@link module:engine/model/textproxy~TextProxy#textNode text node} from which the text proxy starts.
50
+ * Offset in {@link module:engine/model/textproxy~ModelTextProxy#textNode text node} from which the text proxy starts.
51
51
  */
52
52
  offsetInText;
53
53
  /**
@@ -55,7 +55,7 @@ export default class TextProxy extends TypeCheckable {
55
55
  *
56
56
  * @internal
57
57
  * @param textNode Text node which part is represented by this text proxy.
58
- * @param offsetInText Offset in {@link module:engine/model/textproxy~TextProxy#textNode text node} from which the text proxy
58
+ * @param offsetInText Offset in {@link module:engine/model/textproxy~ModelTextProxy#textNode text node} from which the text proxy
59
59
  * starts.
60
60
  * @param length Text proxy length, that is how many text node's characters, starting from `offsetInText` it represents.
61
61
  */
@@ -84,7 +84,7 @@ export default class TextProxy extends TypeCheckable {
84
84
  /**
85
85
  * Offset at which this text proxy starts in it's parent.
86
86
  *
87
- * @see module:engine/model/node~Node#startOffset
87
+ * @see module:engine/model/node~ModelNode#startOffset
88
88
  */
89
89
  get startOffset() {
90
90
  return this.textNode.startOffset !== null ? this.textNode.startOffset + this.offsetInText : null;
@@ -92,7 +92,7 @@ export default class TextProxy extends TypeCheckable {
92
92
  /**
93
93
  * Offset size of this text proxy. Equal to the number of characters represented by the text proxy.
94
94
  *
95
- * @see module:engine/model/node~Node#offsetSize
95
+ * @see module:engine/model/node~ModelNode#offsetSize
96
96
  */
97
97
  get offsetSize() {
98
98
  return this.data.length;
@@ -100,17 +100,18 @@ export default class TextProxy extends TypeCheckable {
100
100
  /**
101
101
  * Offset at which this text proxy ends in it's parent.
102
102
  *
103
- * @see module:engine/model/node~Node#endOffset
103
+ * @see module:engine/model/node~ModelNode#endOffset
104
104
  */
105
105
  get endOffset() {
106
106
  return this.startOffset !== null ? this.startOffset + this.offsetSize : null;
107
107
  }
108
108
  /**
109
- * Flag indicating whether `TextProxy` instance covers only part of the original {@link module:engine/model/text~Text text node}
110
- * (`true`) or the whole text node (`false`).
109
+ * Flag indicating whether `ModelTextProxy` instance covers only part of the original
110
+ * {@link module:engine/model/text~ModelText text node} (`true`) or the whole text node (`false`).
111
111
  *
112
- * This is `false` when text proxy starts at the very beginning of {@link module:engine/model/textproxy~TextProxy#textNode textNode}
113
- * ({@link module:engine/model/textproxy~TextProxy#offsetInText offsetInText} equals `0`) and text proxy sizes is equal to
112
+ * This is `false` when text proxy starts at the very beginning of
113
+ * {@link module:engine/model/textproxy~ModelTextProxy#textNode textNode}
114
+ * ({@link module:engine/model/textproxy~ModelTextProxy#offsetInText offsetInText} equals `0`) and text proxy sizes is equal to
114
115
  * text node size.
115
116
  */
116
117
  get isPartial() {
@@ -131,7 +132,7 @@ export default class TextProxy extends TypeCheckable {
131
132
  /**
132
133
  * Gets path to this text proxy.
133
134
  *
134
- * @see module:engine/model/node~Node#getPath
135
+ * @see module:engine/model/node~ModelNode#getPath
135
136
  */
136
137
  getPath() {
137
138
  const path = this.textNode.getPath();
@@ -194,7 +195,7 @@ export default class TextProxy extends TypeCheckable {
194
195
  }
195
196
  // The magic of type inference using `is` method is centralized in `TypeCheckable` class.
196
197
  // Proper overload would interfere with that.
197
- TextProxy.prototype.is = function (type) {
198
+ ModelTextProxy.prototype.is = function (type) {
198
199
  return type === '$textProxy' || type === 'model:$textProxy' ||
199
200
  // This are legacy values kept for backward compatibility.
200
201
  type === 'textProxy' || type === 'model:textProxy';
@@ -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 { default as Position } from './position.js';
6
- import type Item from './item.js';
7
- import type Range from './range.js';
5
+ import { ModelPosition } from './position.js';
6
+ import { type ModelItem } from './item.js';
7
+ import { type ModelRange } 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 Iterable<TreeWalkerValue> {
11
+ export declare class ModelTreeWalker implements Iterable<ModelTreeWalkerValue> {
12
12
  /**
13
13
  * Walking direction. Defaults `'forward'`.
14
14
  */
15
- readonly direction: TreeWalkerDirection;
15
+ readonly direction: ModelTreeWalkerDirection;
16
16
  /**
17
17
  * Iterator boundaries.
18
18
  *
@@ -21,10 +21,10 @@ export default class TreeWalker implements Iterable<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: ModelRange | null;
25
25
  /**
26
26
  * Flag indicating whether all consecutive characters with the same attributes should be
27
- * returned as one {@link module:engine/model/textproxy~TextProxy} (`true`) or one by one (`false`).
27
+ * returned as one {@link module:engine/model/textproxy~ModelTextProxy} (`true`) or one by one (`false`).
28
28
  */
29
29
  readonly singleCharacters: boolean;
30
30
  /**
@@ -34,14 +34,14 @@ export default class TreeWalker implements Iterable<TreeWalkerValue> {
34
34
  readonly shallow: boolean;
35
35
  /**
36
36
  * Flag indicating whether iterator should ignore `elementEnd` tags. If the option is true walker will not
37
- * return a parent node of the start position. If this option is `true` each {@link module:engine/model/element~Element} will
37
+ * return a parent node of the start position. If this option is `true` each {@link module:engine/model/element~ModelElement} will
38
38
  * be returned once, while if the option is `false` they might be returned twice:
39
39
  * for `'elementStart'` and `'elementEnd'`.
40
40
  */
41
41
  readonly ignoreElementEnd: boolean;
42
42
  /**
43
43
  * Iterator position. This is always static position, even if the initial position was a
44
- * {@link module:engine/model/liveposition~LivePosition live position}. If start position is not defined then position depends
44
+ * {@link module:engine/model/liveposition~ModelLivePosition live position}. If start position is not defined then position depends
45
45
  * on {@link #direction}. If direction is `'forward'` position starts form the beginning, when direction
46
46
  * is `'backward'` position starts from the end.
47
47
  */
@@ -63,20 +63,20 @@ export default class TreeWalker implements Iterable<TreeWalkerValue> {
63
63
  *
64
64
  * @param options Object with configuration.
65
65
  */
66
- constructor(options: TreeWalkerOptions);
66
+ constructor(options: ModelTreeWalkerOptions);
67
67
  /**
68
68
  * Iterable interface.
69
69
  *
70
- * @returns {Iterable.<module:engine/model/treewalker~TreeWalkerValue>}
70
+ * @returns {Iterable.<module:engine/model/treewalker~ModelTreeWalkerValue>}
71
71
  */
72
- [Symbol.iterator](): IterableIterator<TreeWalkerValue>;
72
+ [Symbol.iterator](): IterableIterator<ModelTreeWalkerValue>;
73
73
  /**
74
74
  * Iterator position. This is always static position, even if the initial position was a
75
- * {@link module:engine/model/liveposition~LivePosition live position}. If start position is not defined then position depends
75
+ * {@link module:engine/model/liveposition~ModelLivePosition live position}. If start position is not defined then position depends
76
76
  * on {@link #direction}. If direction is `'forward'` position starts form the beginning, when direction
77
77
  * is `'backward'` position starts from the end.
78
78
  */
79
- get position(): Position;
79
+ get position(): ModelPosition;
80
80
  /**
81
81
  * Moves {@link #position} in the {@link #direction} skipping values as long as the callback function returns `true`.
82
82
  *
@@ -88,17 +88,17 @@ export default class TreeWalker implements Iterable<TreeWalkerValue> {
88
88
  * walker.skip( () => false ); // Do not move the position.
89
89
  * ```
90
90
  *
91
- * @param skip Callback function. Gets {@link module:engine/model/treewalker~TreeWalkerValue} and should
91
+ * @param skip Callback function. Gets {@link module:engine/model/treewalker~ModelTreeWalkerValue} and should
92
92
  * return `true` if the value should be skipped or `false` if not.
93
93
  */
94
- skip(skip: (value: TreeWalkerValue) => boolean): void;
94
+ skip(skip: (value: ModelTreeWalkerValue) => boolean): void;
95
95
  /**
96
96
  * Moves tree walker {@link #position} to provided `position`. Tree walker will
97
97
  * continue traversing from that position.
98
98
  *
99
- * Note: in contrary to {@link ~TreeWalker#skip}, this method does not iterate over the nodes along the way.
99
+ * Note: in contrary to {@link ~ModelTreeWalker#skip}, this method does not iterate over the nodes along the way.
100
100
  * It simply sets the current tree walker position to a new one.
101
- * From the performance standpoint, it is better to use {@link ~TreeWalker#jumpTo} rather than {@link ~TreeWalker#skip}.
101
+ * From the performance standpoint, it is better to use {@link ~ModelTreeWalker#jumpTo} rather than {@link ~ModelTreeWalker#skip}.
102
102
  *
103
103
  * If the provided position is before the start boundary, the position will be
104
104
  * set to the start boundary. If the provided position is after the end boundary,
@@ -107,11 +107,11 @@ export default class TreeWalker implements Iterable<TreeWalkerValue> {
107
107
  *
108
108
  * @param position Position to jump to.
109
109
  */
110
- jumpTo(position: Position): void;
110
+ jumpTo(position: ModelPosition): void;
111
111
  /**
112
112
  * Gets the next tree walker's value.
113
113
  */
114
- next(): IteratorResult<TreeWalkerValue>;
114
+ next(): IteratorResult<ModelTreeWalkerValue>;
115
115
  /**
116
116
  * Makes a step forward in model. Moves the {@link #position} to the next position and returns the encountered value.
117
117
  */
@@ -122,20 +122,20 @@ export default class TreeWalker implements Iterable<TreeWalkerValue> {
122
122
  private _previous;
123
123
  }
124
124
  /**
125
- * Type of the step made by {@link module:engine/model/treewalker~TreeWalker}.
125
+ * Type of the step made by {@link module:engine/model/treewalker~ModelTreeWalker}.
126
126
  * Possible values: `'elementStart'` if walker is at the beginning of a node, `'elementEnd'` if walker is at the end of node,
127
127
  * or `'text'` if walker traversed over text.
128
128
  */
129
- export type TreeWalkerValueType = 'elementStart' | 'elementEnd' | 'text';
129
+ export type ModelTreeWalkerValueType = 'elementStart' | 'elementEnd' | 'text';
130
130
  /**
131
- * Object returned by {@link module:engine/model/treewalker~TreeWalker} when traversing tree model.
131
+ * Object returned by {@link module:engine/model/treewalker~ModelTreeWalker} when traversing tree model.
132
132
  */
133
- export interface TreeWalkerValue {
134
- type: TreeWalkerValueType;
133
+ export interface ModelTreeWalkerValue {
134
+ type: ModelTreeWalkerValueType;
135
135
  /**
136
- * Item between old and new positions of {@link module:engine/model/treewalker~TreeWalker}.
136
+ * Item between old and new positions of {@link module:engine/model/treewalker~ModelTreeWalker}.
137
137
  */
138
- item: Item;
138
+ item: ModelItem;
139
139
  /**
140
140
  * Previous position of the iterator.
141
141
  * * Forward iteration: For `'elementEnd'` it is the last position inside the element. For all other types it is the
@@ -143,7 +143,7 @@ export interface TreeWalkerValue {
143
143
  * * Backward iteration: For `'elementStart'` it is the first position inside the element. For all other types it is
144
144
  * the position after item.
145
145
  */
146
- previousPosition: Position;
146
+ previousPosition: ModelPosition;
147
147
  /**
148
148
  * Next position of the iterator.
149
149
  * * Forward iteration: For `'elementStart'` it is the first position inside the element. For all other types it is
@@ -151,7 +151,7 @@ export interface TreeWalkerValue {
151
151
  * * Backward iteration: For `'elementEnd'` it is last position inside element. For all other types it is the position
152
152
  * before the item.
153
153
  */
154
- nextPosition: Position;
154
+ nextPosition: ModelPosition;
155
155
  /**
156
156
  * Length of the item. For `'elementStart'` it is 1. For `'text'` it is the length of the text. For `'elementEnd'` it is `undefined`.
157
157
  */
@@ -160,31 +160,31 @@ export interface TreeWalkerValue {
160
160
  /**
161
161
  * Tree walking direction.
162
162
  */
163
- export type TreeWalkerDirection = 'forward' | 'backward';
163
+ export type ModelTreeWalkerDirection = 'forward' | 'backward';
164
164
  /**
165
165
  * The configuration of TreeWalker.
166
166
  *
167
167
  * All parameters are optional, but you have to specify either `boundaries` or `startPosition`.
168
168
  */
169
- export interface TreeWalkerOptions {
169
+ export interface ModelTreeWalkerOptions {
170
170
  /**
171
171
  * Walking direction.
172
172
  *
173
173
  * @default 'forward'
174
174
  */
175
- direction?: TreeWalkerDirection;
175
+ direction?: ModelTreeWalkerDirection;
176
176
  /**
177
177
  * Range to define boundaries of the iterator.
178
178
  */
179
- boundaries?: Range | null;
179
+ boundaries?: ModelRange | null;
180
180
  /**
181
181
  * Starting position.
182
182
  */
183
- startPosition?: Position;
183
+ startPosition?: ModelPosition;
184
184
  /**
185
185
  * Flag indicating whether all consecutive characters with the same attributes
186
- * should be returned one by one as multiple {@link module:engine/model/textproxy~TextProxy} (`true`) objects or as one
187
- * {@link module:engine/model/textproxy~TextProxy} (`false`).
186
+ * should be returned one by one as multiple {@link module:engine/model/textproxy~ModelTextProxy} (`true`) objects or as one
187
+ * {@link module:engine/model/textproxy~ModelTextProxy} (`false`).
188
188
  */
189
189
  singleCharacters?: boolean;
190
190
  /**
@@ -195,7 +195,7 @@ export interface TreeWalkerOptions {
195
195
  /**
196
196
  * Flag indicating whether iterator should ignore `elementEnd` tags.
197
197
  * If the option is true walker will not return a parent node of start position. If this option is `true`
198
- * each {@link module:engine/model/element~Element} will be returned once, while if the option is `false` they might be returned
198
+ * each {@link module:engine/model/element~ModelElement} will be returned once, while if the option is `false` they might be returned
199
199
  * twice: for `'elementStart'` and `'elementEnd'`.
200
200
  */
201
201
  ignoreElementEnd?: boolean;
@@ -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 { default as Position, getTextNodeAtPosition, getNodeAfterPosition, getNodeBeforePosition } from './position.js';
6
- import TextProxy from './textproxy.js';
5
+ import { ModelPosition, getTextNodeAtPosition, getNodeAfterPosition, getNodeBeforePosition } from './position.js';
6
+ import { ModelTextProxy } from './textproxy.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 ModelTreeWalker {
12
12
  /**
13
13
  * Walking direction. Defaults `'forward'`.
14
14
  */
@@ -24,7 +24,7 @@ export default class TreeWalker {
24
24
  boundaries;
25
25
  /**
26
26
  * Flag indicating whether all consecutive characters with the same attributes should be
27
- * returned as one {@link module:engine/model/textproxy~TextProxy} (`true`) or one by one (`false`).
27
+ * returned as one {@link module:engine/model/textproxy~ModelTextProxy} (`true`) or one by one (`false`).
28
28
  */
29
29
  singleCharacters;
30
30
  /**
@@ -34,14 +34,14 @@ export default class TreeWalker {
34
34
  shallow;
35
35
  /**
36
36
  * Flag indicating whether iterator should ignore `elementEnd` tags. If the option is true walker will not
37
- * return a parent node of the start position. If this option is `true` each {@link module:engine/model/element~Element} will
37
+ * return a parent node of the start position. If this option is `true` each {@link module:engine/model/element~ModelElement} will
38
38
  * be returned once, while if the option is `false` they might be returned twice:
39
39
  * for `'elementStart'` and `'elementEnd'`.
40
40
  */
41
41
  ignoreElementEnd;
42
42
  /**
43
43
  * Iterator position. This is always static position, even if the initial position was a
44
- * {@link module:engine/model/liveposition~LivePosition live position}. If start position is not defined then position depends
44
+ * {@link module:engine/model/liveposition~ModelLivePosition live position}. If start position is not defined then position depends
45
45
  * on {@link #direction}. If direction is `'forward'` position starts form the beginning, when direction
46
46
  * is `'backward'` position starts from the end.
47
47
  */
@@ -87,7 +87,7 @@ export default class TreeWalker {
87
87
  this._position = options.startPosition.clone();
88
88
  }
89
89
  else {
90
- this._position = Position._createAt(this.boundaries[this.direction == 'backward' ? 'end' : 'start']);
90
+ this._position = ModelPosition._createAt(this.boundaries[this.direction == 'backward' ? 'end' : 'start']);
91
91
  }
92
92
  // Reset position stickiness in case it was set to other value, as the stickiness is kept after cloning.
93
93
  this.position.stickiness = 'toNone';
@@ -101,14 +101,14 @@ export default class TreeWalker {
101
101
  /**
102
102
  * Iterable interface.
103
103
  *
104
- * @returns {Iterable.<module:engine/model/treewalker~TreeWalkerValue>}
104
+ * @returns {Iterable.<module:engine/model/treewalker~ModelTreeWalkerValue>}
105
105
  */
106
106
  [Symbol.iterator]() {
107
107
  return this;
108
108
  }
109
109
  /**
110
110
  * Iterator position. This is always static position, even if the initial position was a
111
- * {@link module:engine/model/liveposition~LivePosition live position}. If start position is not defined then position depends
111
+ * {@link module:engine/model/liveposition~ModelLivePosition live position}. If start position is not defined then position depends
112
112
  * on {@link #direction}. If direction is `'forward'` position starts form the beginning, when direction
113
113
  * is `'backward'` position starts from the end.
114
114
  */
@@ -126,7 +126,7 @@ export default class TreeWalker {
126
126
  * walker.skip( () => false ); // Do not move the position.
127
127
  * ```
128
128
  *
129
- * @param skip Callback function. Gets {@link module:engine/model/treewalker~TreeWalkerValue} and should
129
+ * @param skip Callback function. Gets {@link module:engine/model/treewalker~ModelTreeWalkerValue} and should
130
130
  * return `true` if the value should be skipped or `false` if not.
131
131
  */
132
132
  skip(skip) {
@@ -145,9 +145,9 @@ export default class TreeWalker {
145
145
  * Moves tree walker {@link #position} to provided `position`. Tree walker will
146
146
  * continue traversing from that position.
147
147
  *
148
- * Note: in contrary to {@link ~TreeWalker#skip}, this method does not iterate over the nodes along the way.
148
+ * Note: in contrary to {@link ~ModelTreeWalker#skip}, this method does not iterate over the nodes along the way.
149
149
  * It simply sets the current tree walker position to a new one.
150
- * From the performance standpoint, it is better to use {@link ~TreeWalker#jumpTo} rather than {@link ~TreeWalker#skip}.
150
+ * From the performance standpoint, it is better to use {@link ~ModelTreeWalker#jumpTo} rather than {@link ~ModelTreeWalker#skip}.
151
151
  *
152
152
  * If the provided position is before the start boundary, the position will be
153
153
  * set to the start boundary. If the provided position is after the end boundary,
@@ -225,7 +225,7 @@ export default class TreeWalker {
225
225
  charactersCount = offset - position.offset;
226
226
  }
227
227
  const offsetInTextNode = position.offset - node.startOffset;
228
- const item = new TextProxy(node, offsetInTextNode, charactersCount);
228
+ const item = new ModelTextProxy(node, offsetInTextNode, charactersCount);
229
229
  position.offset += charactersCount;
230
230
  this._position = position;
231
231
  return formatReturnValue('text', item, previousPosition, position, charactersCount);
@@ -287,7 +287,7 @@ export default class TreeWalker {
287
287
  charactersCount = position.offset - offset;
288
288
  }
289
289
  const offsetInTextNode = position.offset - node.startOffset;
290
- const item = new TextProxy(node, offsetInTextNode - charactersCount, charactersCount);
290
+ const item = new ModelTextProxy(node, offsetInTextNode - charactersCount, charactersCount);
291
291
  position.offset -= charactersCount;
292
292
  this._position = position;
293
293
  return formatReturnValue('text', item, previousPosition, position, charactersCount);