@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,16 +5,16 @@
5
5
  /**
6
6
  * Abstract base operation class.
7
7
  */
8
- export default class Operation {
8
+ export class Operation {
9
9
  /**
10
- * {@link module:engine/model/document~Document#version} on which operation can be applied. If you try to
10
+ * {@link module:engine/model/document~ModelDocument#version} on which operation can be applied. If you try to
11
11
  * {@link module:engine/model/model~Model#applyOperation apply} operation with different base version than the
12
- * {@link module:engine/model/document~Document#version document version} the
12
+ * {@link module:engine/model/document~ModelDocument#version document version} the
13
13
  * {@link module:utils/ckeditorerror~CKEditorError model-document-applyOperation-wrong-version} error is thrown.
14
14
  */
15
15
  baseVersion;
16
16
  /**
17
- * Defines whether operation is executed on attached or detached {@link module:engine/model/item~Item items}.
17
+ * Defines whether operation is executed on attached or detached {@link module:engine/model/item~ModelItem items}.
18
18
  */
19
19
  isDocumentOperation;
20
20
  /**
@@ -28,7 +28,7 @@ export default class Operation {
28
28
  /**
29
29
  * Base operation constructor.
30
30
  *
31
- * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
31
+ * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
32
32
  * can be applied or `null` if the operation operates on detached (non-document) tree.
33
33
  */
34
34
  constructor(baseVersion) {
@@ -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 Operation from './operation.js';
6
- import type Document from '../document.js';
5
+ import { Operation } from './operation.js';
6
+ import { type ModelDocument } from '../document.js';
7
7
  /**
8
8
  * A factory class for creating operations.
9
9
  */
10
- export default abstract class OperationFactory {
10
+ export declare abstract class OperationFactory {
11
11
  /**
12
12
  * Creates an operation instance from a JSON object (parsed JSON string).
13
13
  *
14
14
  * @param json Deserialized JSON object.
15
15
  * @param document Document on which this operation will be applied.
16
16
  */
17
- static fromJSON(json: any, document: Document): Operation;
17
+ static fromJSON(json: any, document: ModelDocument): Operation;
18
18
  }
@@ -5,17 +5,17 @@
5
5
  /**
6
6
  * @module engine/model/operation/operationfactory
7
7
  */
8
- import AttributeOperation from './attributeoperation.js';
9
- import InsertOperation from './insertoperation.js';
10
- import MarkerOperation from './markeroperation.js';
11
- import MoveOperation from './moveoperation.js';
12
- import NoOperation from './nooperation.js';
13
- import Operation from './operation.js';
14
- import RenameOperation from './renameoperation.js';
15
- import RootAttributeOperation from './rootattributeoperation.js';
16
- import RootOperation from './rootoperation.js';
17
- import SplitOperation from './splitoperation.js';
18
- import MergeOperation from './mergeoperation.js';
8
+ import { AttributeOperation } from './attributeoperation.js';
9
+ import { InsertOperation } from './insertoperation.js';
10
+ import { MarkerOperation } from './markeroperation.js';
11
+ import { MoveOperation } from './moveoperation.js';
12
+ import { NoOperation } from './nooperation.js';
13
+ import { Operation } from './operation.js';
14
+ import { RenameOperation } from './renameoperation.js';
15
+ import { RootAttributeOperation } from './rootattributeoperation.js';
16
+ import { RootOperation } from './rootoperation.js';
17
+ import { SplitOperation } from './splitoperation.js';
18
+ import { MergeOperation } from './mergeoperation.js';
19
19
  const operations = {};
20
20
  operations[AttributeOperation.className] = AttributeOperation;
21
21
  operations[InsertOperation.className] = InsertOperation;
@@ -31,7 +31,7 @@ operations[MergeOperation.className] = MergeOperation;
31
31
  /**
32
32
  * A factory class for creating operations.
33
33
  */
34
- export default class OperationFactory {
34
+ export class OperationFactory {
35
35
  /**
36
36
  * Creates an operation instance from a JSON object (parsed JSON string).
37
37
  *
@@ -5,20 +5,20 @@
5
5
  /**
6
6
  * @module engine/model/operation/renameoperation
7
7
  */
8
- import Operation from './operation.js';
9
- import Position from '../position.js';
10
- import type Document from '../document.js';
11
- import type { Selectable } from '../selection.js';
8
+ import { Operation } from './operation.js';
9
+ import { ModelPosition } from '../position.js';
10
+ import { type ModelDocument } from '../document.js';
11
+ import type { ModelSelectable } from '../selection.js';
12
12
  /**
13
13
  * Operation to change element's name.
14
14
  *
15
15
  * Using this class you can change element's name.
16
16
  */
17
- export default class RenameOperation extends Operation {
17
+ export declare class RenameOperation extends Operation {
18
18
  /**
19
19
  * Position before an element to change.
20
20
  */
21
- position: Position;
21
+ position: ModelPosition;
22
22
  /**
23
23
  * Current name of the element.
24
24
  */
@@ -33,10 +33,10 @@ export default class RenameOperation extends Operation {
33
33
  * @param position Position before an element to change.
34
34
  * @param oldName Current name of the element.
35
35
  * @param newName New name for the element.
36
- * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
36
+ * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
37
37
  * can be applied or `null` if the operation operates on detached (non-document) tree.
38
38
  */
39
- constructor(position: Position, oldName: string, newName: string, baseVersion: number | null);
39
+ constructor(position: ModelPosition, oldName: string, newName: string, baseVersion: number | null);
40
40
  /**
41
41
  * @inheritDoc
42
42
  */
@@ -44,7 +44,7 @@ export default class RenameOperation extends Operation {
44
44
  /**
45
45
  * @inheritDoc
46
46
  */
47
- get affectedSelectable(): Selectable;
47
+ get affectedSelectable(): ModelSelectable;
48
48
  /**
49
49
  * Creates and returns an operation that has the same parameters as this operation.
50
50
  *
@@ -79,5 +79,5 @@ export default class RenameOperation extends Operation {
79
79
  * @param json Deserialized JSON object.
80
80
  * @param document Document on which this operation will be applied.
81
81
  */
82
- static fromJSON(json: any, document: Document): RenameOperation;
82
+ static fromJSON(json: any, document: ModelDocument): RenameOperation;
83
83
  }
@@ -5,16 +5,16 @@
5
5
  /**
6
6
  * @module engine/model/operation/renameoperation
7
7
  */
8
- import Operation from './operation.js';
9
- import Element from '../element.js';
10
- import Position from '../position.js';
8
+ import { Operation } from './operation.js';
9
+ import { ModelElement } from '../element.js';
10
+ import { ModelPosition } from '../position.js';
11
11
  import { CKEditorError } from '@ckeditor/ckeditor5-utils';
12
12
  /**
13
13
  * Operation to change element's name.
14
14
  *
15
15
  * Using this class you can change element's name.
16
16
  */
17
- export default class RenameOperation extends Operation {
17
+ export class RenameOperation extends Operation {
18
18
  /**
19
19
  * Position before an element to change.
20
20
  */
@@ -33,7 +33,7 @@ export default class RenameOperation extends Operation {
33
33
  * @param position Position before an element to change.
34
34
  * @param oldName Current name of the element.
35
35
  * @param newName New name for the element.
36
- * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
36
+ * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
37
37
  * can be applied or `null` if the operation operates on detached (non-document) tree.
38
38
  */
39
39
  constructor(position, oldName, newName, baseVersion) {
@@ -76,7 +76,7 @@ export default class RenameOperation extends Operation {
76
76
  */
77
77
  _validate() {
78
78
  const element = this.position.nodeAfter;
79
- if (!(element instanceof Element)) {
79
+ if (!(element instanceof ModelElement)) {
80
80
  /**
81
81
  * Given position is invalid or node after it is not instance of Element.
82
82
  *
@@ -122,6 +122,6 @@ export default class RenameOperation extends Operation {
122
122
  * @param document Document on which this operation will be applied.
123
123
  */
124
124
  static fromJSON(json, document) {
125
- return new RenameOperation(Position.fromJSON(json.position, document), json.oldName, json.newName, json.baseVersion);
125
+ return new RenameOperation(ModelPosition.fromJSON(json.position, document), json.oldName, json.newName, json.baseVersion);
126
126
  }
127
127
  }
@@ -5,10 +5,10 @@
5
5
  /**
6
6
  * @module engine/model/operation/rootattributeoperation
7
7
  */
8
- import Operation from './operation.js';
9
- import type Document from '../document.js';
10
- import type RootElement from '../rootelement.js';
11
- import type { Selectable } from '../selection.js';
8
+ import { Operation } from './operation.js';
9
+ import { type ModelDocument } from '../document.js';
10
+ import { type ModelRootElement } from '../rootelement.js';
11
+ import type { ModelSelectable } from '../selection.js';
12
12
  /**
13
13
  * Operation to change root element's attribute. Using this class you can add, remove or change value of the attribute.
14
14
  *
@@ -16,14 +16,14 @@ import type { Selectable } from '../selection.js';
16
16
  * {@link module:engine/model/operation/attributeoperation~AttributeOperation}.
17
17
  * It is because {@link module:engine/model/operation/attributeoperation~AttributeOperation}
18
18
  * requires a range to change and root element can't
19
- * be a part of range because every {@link module:engine/model/position~Position} has to be inside a root.
20
- * {@link module:engine/model/position~Position} can't be created before a root element.
19
+ * be a part of range because every {@link module:engine/model/position~ModelPosition} has to be inside a root.
20
+ * {@link module:engine/model/position~ModelPosition} can't be created before a root element.
21
21
  */
22
- export default class RootAttributeOperation extends Operation {
22
+ export declare class RootAttributeOperation extends Operation {
23
23
  /**
24
24
  * Root element to change.
25
25
  */
26
- readonly root: RootElement;
26
+ readonly root: ModelRootElement;
27
27
  /**
28
28
  * Key of an attribute to change or remove.
29
29
  */
@@ -48,10 +48,10 @@ export default class RootAttributeOperation extends Operation {
48
48
  * @param key Key of an attribute to change or remove.
49
49
  * @param oldValue Old value of the attribute with given key or `null`, if attribute was not set before.
50
50
  * @param newValue New value of the attribute with given key or `null`, if operation should remove attribute.
51
- * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
51
+ * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
52
52
  * can be applied or `null` if the operation operates on detached (non-document) tree.
53
53
  */
54
- constructor(root: RootElement, key: string, oldValue: unknown, newValue: unknown, baseVersion: number | null);
54
+ constructor(root: ModelRootElement, key: string, oldValue: unknown, newValue: unknown, baseVersion: number | null);
55
55
  /**
56
56
  * @inheritDoc
57
57
  */
@@ -59,7 +59,7 @@ export default class RootAttributeOperation extends Operation {
59
59
  /**
60
60
  * @inheritDoc
61
61
  */
62
- get affectedSelectable(): Selectable;
62
+ get affectedSelectable(): ModelSelectable;
63
63
  /**
64
64
  * Creates and returns an operation that has the same parameters as this operation.
65
65
  *
@@ -94,5 +94,5 @@ export default class RootAttributeOperation extends Operation {
94
94
  * @param json Deserialized JSON object.
95
95
  * @param document Document on which this operation will be applied.
96
96
  */
97
- static fromJSON(json: any, document: Document): RootAttributeOperation;
97
+ static fromJSON(json: any, document: ModelDocument): RootAttributeOperation;
98
98
  }
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module engine/model/operation/rootattributeoperation
7
7
  */
8
- import Operation from './operation.js';
8
+ import { Operation } from './operation.js';
9
9
  import { CKEditorError } from '@ckeditor/ckeditor5-utils';
10
10
  /**
11
11
  * Operation to change root element's attribute. Using this class you can add, remove or change value of the attribute.
@@ -14,10 +14,10 @@ import { CKEditorError } from '@ckeditor/ckeditor5-utils';
14
14
  * {@link module:engine/model/operation/attributeoperation~AttributeOperation}.
15
15
  * It is because {@link module:engine/model/operation/attributeoperation~AttributeOperation}
16
16
  * requires a range to change and root element can't
17
- * be a part of range because every {@link module:engine/model/position~Position} has to be inside a root.
18
- * {@link module:engine/model/position~Position} can't be created before a root element.
17
+ * be a part of range because every {@link module:engine/model/position~ModelPosition} has to be inside a root.
18
+ * {@link module:engine/model/position~ModelPosition} can't be created before a root element.
19
19
  */
20
- export default class RootAttributeOperation extends Operation {
20
+ export class RootAttributeOperation extends Operation {
21
21
  /**
22
22
  * Root element to change.
23
23
  */
@@ -46,7 +46,7 @@ export default class RootAttributeOperation extends Operation {
46
46
  * @param key Key of an attribute to change or remove.
47
47
  * @param oldValue Old value of the attribute with given key or `null`, if attribute was not set before.
48
48
  * @param newValue New value of the attribute with given key or `null`, if operation should remove attribute.
49
- * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
49
+ * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
50
50
  * can be applied or `null` if the operation operates on detached (non-document) tree.
51
51
  */
52
52
  constructor(root, key, oldValue, newValue, baseVersion) {
@@ -100,7 +100,7 @@ export default class RootAttributeOperation extends Operation {
100
100
  * The element to change is not a root element.
101
101
  *
102
102
  * @error rootattribute-operation-not-a-root
103
- * @param {module:engine/model/rootelement~RootElement} root The root element.
103
+ * @param {module:engine/model/rootelement~ModelRootElement} root The root element.
104
104
  * @param {string} key The key of the attribute.
105
105
  */
106
106
  throw new CKEditorError('rootattribute-operation-not-a-root', this, { root: this.root, key: this.key });
@@ -110,7 +110,7 @@ export default class RootAttributeOperation extends Operation {
110
110
  * The attribute which should be removed does not exist for the given node.
111
111
  *
112
112
  * @error rootattribute-operation-wrong-old-value
113
- * @param {module:engine/model/rootelement~RootElement} root The root element.
113
+ * @param {module:engine/model/rootelement~ModelRootElement} root The root element.
114
114
  * @param {string} key The key of the attribute.
115
115
  */
116
116
  throw new CKEditorError('rootattribute-operation-wrong-old-value', this, { root: this.root, key: this.key });
@@ -120,7 +120,7 @@ export default class RootAttributeOperation extends Operation {
120
120
  * The attribute with given key already exists for the given node.
121
121
  *
122
122
  * @error rootattribute-operation-attribute-exists
123
- * @param {module:engine/model/rootelement~RootElement} root The root element.
123
+ * @param {module:engine/model/rootelement~ModelRootElement} root The root element.
124
124
  * @param {string} key The key of the attribute.
125
125
  */
126
126
  throw new CKEditorError('rootattribute-operation-attribute-exists', this, { root: this.root, key: this.key });
@@ -5,13 +5,13 @@
5
5
  /**
6
6
  * @module engine/model/operation/rootoperation
7
7
  */
8
- import Operation from './operation.js';
9
- import type Document from '../document.js';
10
- import type { Selectable } from '../selection.js';
8
+ import { Operation } from './operation.js';
9
+ import { type ModelDocument } from '../document.js';
10
+ import type { ModelSelectable } from '../selection.js';
11
11
  /**
12
12
  * Operation that creates (or attaches) or detaches a root element.
13
13
  */
14
- export default class RootOperation extends Operation {
14
+ export declare class RootOperation extends Operation {
15
15
  /**
16
16
  * Root name to create or detach.
17
17
  */
@@ -35,9 +35,9 @@ export default class RootOperation extends Operation {
35
35
  * @param elementName Root element name.
36
36
  * @param isAdd Specifies whether the operation adds (`true`) or detaches the root (`false`).
37
37
  * @param document Document which owns the root.
38
- * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation can be applied.
38
+ * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation can be applied.
39
39
  */
40
- constructor(rootName: string, elementName: string, isAdd: boolean, document: Document, baseVersion: number);
40
+ constructor(rootName: string, elementName: string, isAdd: boolean, document: ModelDocument, baseVersion: number);
41
41
  /**
42
42
  * @inheritDoc
43
43
  */
@@ -45,7 +45,7 @@ export default class RootOperation extends Operation {
45
45
  /**
46
46
  * @inheritDoc
47
47
  */
48
- get affectedSelectable(): Selectable;
48
+ get affectedSelectable(): ModelSelectable;
49
49
  /**
50
50
  * @inheritDoc
51
51
  */
@@ -72,5 +72,5 @@ export default class RootOperation extends Operation {
72
72
  * @param json Deserialized JSON object.
73
73
  * @param document Document on which this operation will be applied.
74
74
  */
75
- static fromJSON(json: any, document: Document): RootOperation;
75
+ static fromJSON(json: any, document: ModelDocument): RootOperation;
76
76
  }
@@ -5,11 +5,11 @@
5
5
  /**
6
6
  * @module engine/model/operation/rootoperation
7
7
  */
8
- import Operation from './operation.js';
8
+ import { Operation } from './operation.js';
9
9
  /**
10
10
  * Operation that creates (or attaches) or detaches a root element.
11
11
  */
12
- export default class RootOperation extends Operation {
12
+ export class RootOperation extends Operation {
13
13
  /**
14
14
  * Root name to create or detach.
15
15
  */
@@ -33,7 +33,7 @@ export default class RootOperation extends Operation {
33
33
  * @param elementName Root element name.
34
34
  * @param isAdd Specifies whether the operation adds (`true`) or detaches the root (`false`).
35
35
  * @param document Document which owns the root.
36
- * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation can be applied.
36
+ * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation can be applied.
37
37
  */
38
38
  constructor(rootName, elementName, isAdd, document, baseVersion) {
39
39
  super(baseVersion);
@@ -5,21 +5,21 @@
5
5
  /**
6
6
  * @module engine/model/operation/splitoperation
7
7
  */
8
- import Operation from './operation.js';
9
- import Position from '../position.js';
10
- import Range from '../range.js';
11
- import type Document from '../document.js';
12
- import type { Selectable } from '../selection.js';
8
+ import { Operation } from './operation.js';
9
+ import { ModelPosition } from '../position.js';
10
+ import { ModelRange } from '../range.js';
11
+ import { type ModelDocument } from '../document.js';
12
+ import type { ModelSelectable } from '../selection.js';
13
13
  /**
14
- * Operation to split {@link module:engine/model/element~Element an element} at given
14
+ * Operation to split {@link module:engine/model/element~ModelElement an element} at given
15
15
  * {@link module:engine/model/operation/splitoperation~SplitOperation#splitPosition split position} into two elements,
16
16
  * both containing a part of the element's original content.
17
17
  */
18
- export default class SplitOperation extends Operation {
18
+ export declare class SplitOperation extends Operation {
19
19
  /**
20
20
  * Position at which an element should be split.
21
21
  */
22
- splitPosition: Position;
22
+ splitPosition: ModelPosition;
23
23
  /**
24
24
  * Total offset size of elements that are in the split element after `position`.
25
25
  */
@@ -27,14 +27,14 @@ export default class SplitOperation extends Operation {
27
27
  /**
28
28
  * Position at which the clone of split element (or element from graveyard) will be inserted.
29
29
  */
30
- insertionPosition: Position;
30
+ insertionPosition: ModelPosition;
31
31
  /**
32
32
  * Position in the graveyard root before the element which should be used as a parent of the nodes after `position`.
33
33
  * If it is not set, a copy of the the `position` parent will be used.
34
34
  *
35
35
  * The default behavior is to clone the split element. Element from graveyard is used during undo.
36
36
  */
37
- graveyardPosition: Position | null;
37
+ graveyardPosition: ModelPosition | null;
38
38
  /**
39
39
  * Creates a split operation.
40
40
  *
@@ -43,10 +43,10 @@ export default class SplitOperation extends Operation {
43
43
  * @param insertionPosition Position at which the clone of split element (or element from graveyard) will be inserted.
44
44
  * @param graveyardPosition Position in the graveyard root before the element which
45
45
  * should be used as a parent of the nodes after `position`. If it is not set, a copy of the the `position` parent will be used.
46
- * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
46
+ * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
47
47
  * can be applied or `null` if the operation operates on detached (non-document) tree.
48
48
  */
49
- constructor(splitPosition: Position, howMany: number, insertionPosition: Position, graveyardPosition: Position | null, baseVersion: number | null);
49
+ constructor(splitPosition: ModelPosition, howMany: number, insertionPosition: ModelPosition, graveyardPosition: ModelPosition | null, baseVersion: number | null);
50
50
  /**
51
51
  * @inheritDoc
52
52
  */
@@ -56,16 +56,16 @@ export default class SplitOperation extends Operation {
56
56
  *
57
57
  * This is a position where nodes that are after the split position will be moved to.
58
58
  */
59
- get moveTargetPosition(): Position;
59
+ get moveTargetPosition(): ModelPosition;
60
60
  /**
61
61
  * Artificial range that contains all the nodes from the split element that will be moved to the new element.
62
62
  * The range starts at {@link #splitPosition} and ends in the same parent, at `POSITIVE_INFINITY` offset.
63
63
  */
64
- get movedRange(): Range;
64
+ get movedRange(): ModelRange;
65
65
  /**
66
66
  * @inheritDoc
67
67
  */
68
- get affectedSelectable(): Selectable;
68
+ get affectedSelectable(): ModelSelectable;
69
69
  /**
70
70
  * Creates and returns an operation that has the same parameters as this operation.
71
71
  *
@@ -98,12 +98,12 @@ export default class SplitOperation extends Operation {
98
98
  * Helper function that returns a default insertion position basing on given `splitPosition`. The default insertion
99
99
  * position is after the split element.
100
100
  */
101
- static getInsertionPosition(splitPosition: Position): Position;
101
+ static getInsertionPosition(splitPosition: ModelPosition): ModelPosition;
102
102
  /**
103
103
  * Creates `SplitOperation` object from deserialized object, i.e. from parsed JSON string.
104
104
  *
105
105
  * @param json Deserialized JSON object.
106
106
  * @param document Document on which this operation will be applied.
107
107
  */
108
- static fromJSON(json: any, document: Document): SplitOperation;
108
+ static fromJSON(json: any, document: ModelDocument): SplitOperation;
109
109
  }
@@ -5,18 +5,18 @@
5
5
  /**
6
6
  * @module engine/model/operation/splitoperation
7
7
  */
8
- import Operation from './operation.js';
9
- import MergeOperation from './mergeoperation.js';
10
- import Position from '../position.js';
11
- import Range from '../range.js';
8
+ import { Operation } from './operation.js';
9
+ import { MergeOperation } from './mergeoperation.js';
10
+ import { ModelPosition } from '../position.js';
11
+ import { ModelRange } from '../range.js';
12
12
  import { _insert, _move } from './utils.js';
13
13
  import { CKEditorError } from '@ckeditor/ckeditor5-utils';
14
14
  /**
15
- * Operation to split {@link module:engine/model/element~Element an element} at given
15
+ * Operation to split {@link module:engine/model/element~ModelElement an element} at given
16
16
  * {@link module:engine/model/operation/splitoperation~SplitOperation#splitPosition split position} into two elements,
17
17
  * both containing a part of the element's original content.
18
18
  */
19
- export default class SplitOperation extends Operation {
19
+ export class SplitOperation extends Operation {
20
20
  /**
21
21
  * Position at which an element should be split.
22
22
  */
@@ -44,7 +44,7 @@ export default class SplitOperation extends Operation {
44
44
  * @param insertionPosition Position at which the clone of split element (or element from graveyard) will be inserted.
45
45
  * @param graveyardPosition Position in the graveyard root before the element which
46
46
  * should be used as a parent of the nodes after `position`. If it is not set, a copy of the the `position` parent will be used.
47
- * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
47
+ * @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
48
48
  * can be applied or `null` if the operation operates on detached (non-document) tree.
49
49
  */
50
50
  constructor(splitPosition, howMany, insertionPosition, graveyardPosition, baseVersion) {
@@ -74,7 +74,7 @@ export default class SplitOperation extends Operation {
74
74
  get moveTargetPosition() {
75
75
  const path = this.insertionPosition.path.slice();
76
76
  path.push(0);
77
- return new Position(this.insertionPosition.root, path);
77
+ return new ModelPosition(this.insertionPosition.root, path);
78
78
  }
79
79
  /**
80
80
  * Artificial range that contains all the nodes from the split element that will be moved to the new element.
@@ -82,7 +82,7 @@ export default class SplitOperation extends Operation {
82
82
  */
83
83
  get movedRange() {
84
84
  const end = this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);
85
- return new Range(this.splitPosition, end);
85
+ return new ModelRange(this.splitPosition, end);
86
86
  }
87
87
  /**
88
88
  * @inheritDoc
@@ -90,11 +90,11 @@ export default class SplitOperation extends Operation {
90
90
  get affectedSelectable() {
91
91
  // These could be positions but `Selectable` type only supports `Iterable<Range>`.
92
92
  const ranges = [
93
- Range._createFromPositionAndShift(this.splitPosition, 0),
94
- Range._createFromPositionAndShift(this.insertionPosition, 0)
93
+ ModelRange._createFromPositionAndShift(this.splitPosition, 0),
94
+ ModelRange._createFromPositionAndShift(this.insertionPosition, 0)
95
95
  ];
96
96
  if (this.graveyardPosition) {
97
- ranges.push(Range._createFromPositionAndShift(this.graveyardPosition, 0));
97
+ ranges.push(ModelRange._createFromPositionAndShift(this.graveyardPosition, 0));
98
98
  }
99
99
  return ranges;
100
100
  }
@@ -111,7 +111,7 @@ export default class SplitOperation extends Operation {
111
111
  */
112
112
  getReversed() {
113
113
  const graveyard = this.splitPosition.root.document.graveyard;
114
- const graveyardPosition = new Position(graveyard, [0]);
114
+ const graveyardPosition = new ModelPosition(graveyard, [0]);
115
115
  return new MergeOperation(this.moveTargetPosition, this.howMany, this.splitPosition, graveyardPosition, this.baseVersion + 1);
116
116
  }
117
117
  /**
@@ -162,13 +162,13 @@ export default class SplitOperation extends Operation {
162
162
  _execute() {
163
163
  const splitElement = this.splitPosition.parent;
164
164
  if (this.graveyardPosition) {
165
- _move(Range._createFromPositionAndShift(this.graveyardPosition, 1), this.insertionPosition);
165
+ _move(ModelRange._createFromPositionAndShift(this.graveyardPosition, 1), this.insertionPosition);
166
166
  }
167
167
  else {
168
168
  const newElement = splitElement._clone();
169
169
  _insert(this.insertionPosition, newElement);
170
170
  }
171
- const sourceRange = new Range(Position._createAt(splitElement, this.splitPosition.offset), Position._createAt(splitElement, splitElement.maxOffset));
171
+ const sourceRange = new ModelRange(ModelPosition._createAt(splitElement, this.splitPosition.offset), ModelPosition._createAt(splitElement, splitElement.maxOffset));
172
172
  _move(sourceRange, this.moveTargetPosition);
173
173
  }
174
174
  /**
@@ -196,7 +196,7 @@ export default class SplitOperation extends Operation {
196
196
  static getInsertionPosition(splitPosition) {
197
197
  const path = splitPosition.path.slice(0, -1);
198
198
  path[path.length - 1]++;
199
- return new Position(splitPosition.root, path, 'toPrevious');
199
+ return new ModelPosition(splitPosition.root, path, 'toPrevious');
200
200
  }
201
201
  /**
202
202
  * Creates `SplitOperation` object from deserialized object, i.e. from parsed JSON string.
@@ -205,9 +205,9 @@ export default class SplitOperation extends Operation {
205
205
  * @param document Document on which this operation will be applied.
206
206
  */
207
207
  static fromJSON(json, document) {
208
- const splitPosition = Position.fromJSON(json.splitPosition, document);
209
- const insertionPosition = Position.fromJSON(json.insertionPosition, document);
210
- const graveyardPosition = json.graveyardPosition ? Position.fromJSON(json.graveyardPosition, document) : null;
208
+ const splitPosition = ModelPosition.fromJSON(json.splitPosition, document);
209
+ const insertionPosition = ModelPosition.fromJSON(json.insertionPosition, document);
210
+ const graveyardPosition = json.graveyardPosition ? ModelPosition.fromJSON(json.graveyardPosition, document) : null;
211
211
  return new this(splitPosition, json.howMany, insertionPosition, graveyardPosition, json.baseVersion);
212
212
  }
213
213
  }
@@ -2,8 +2,8 @@
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 Operation from './operation.js';
6
- import type Document from '../document.js';
5
+ import { type Operation } from './operation.js';
6
+ import { type ModelDocument } from '../document.js';
7
7
  /**
8
8
  * Transforms operation `a` by operation `b`.
9
9
  *
@@ -11,6 +11,7 @@ import type Document from '../document.js';
11
11
  * @param b Operation to transform by.
12
12
  * @param context Transformation context for this transformation.
13
13
  * @returns Transformation result.
14
+ * @internal
14
15
  */
15
16
  export declare function transform(a: Operation, b: Operation, context?: TransformationContext): Array<Operation>;
16
17
  /**
@@ -18,7 +19,7 @@ export declare function transform(a: Operation, b: Operation, context?: Transfor
18
19
  * both transformed `operationsA` and transformed `operationsB` are returned.
19
20
  *
20
21
  * Note, that the first operation in each set should base on the same document state (
21
- * {@link module:engine/model/document~Document#version document version}).
22
+ * {@link module:engine/model/document~ModelDocument#version document version}).
22
23
  *
23
24
  * It is assumed that `operationsA` are "more important" during conflict resolution between two operations.
24
25
  *
@@ -47,16 +48,16 @@ export declare function transform(a: Operation, b: Operation, context?: Transfor
47
48
  * so the removed nodes won't end up back in the document root. When set to `true`, context data will be used.
48
49
  * @returns Transformation result.
49
50
  */
50
- export declare function transformSets(operationsA: Array<Operation>, operationsB: Array<Operation>, options: {
51
- document: Document;
51
+ export declare function transformOperationSets(operationsA: Array<Operation>, operationsB: Array<Operation>, options: {
52
+ document: ModelDocument;
52
53
  useRelations?: boolean;
53
54
  padWithNoOps?: boolean;
54
55
  forceWeakRemove?: boolean;
55
- }): TransformSetsResult;
56
+ }): TransformOperationSetsResult;
56
57
  /**
57
- * The result of {@link module:engine/model/operation/transform~transformSets}.
58
+ * The result of {@link module:engine/model/operation/transform~transformOperationSets}.
58
59
  */
59
- export interface TransformSetsResult {
60
+ export interface TransformOperationSetsResult {
60
61
  /**
61
62
  * Transformed `operationsA`.
62
63
  */
@@ -74,6 +75,8 @@ export interface TransformSetsResult {
74
75
  /**
75
76
  * Holds additional contextual information about a transformed pair of operations (`a` and `b`). Those information
76
77
  * can be used for better conflict resolving.
78
+ *
79
+ * @internal
77
80
  */
78
81
  export type TransformationContext = {
79
82
  /**