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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/dist/index.js +2563 -2257
  2. package/dist/index.js.map +1 -1
  3. package/package.json +3 -3
  4. package/src/controller/datacontroller.d.ts +33 -32
  5. package/src/controller/datacontroller.js +29 -28
  6. package/src/controller/editingcontroller.d.ts +8 -8
  7. package/src/controller/editingcontroller.js +10 -10
  8. package/src/conversion/conversion.d.ts +18 -19
  9. package/src/conversion/conversion.js +4 -4
  10. package/src/conversion/conversionhelpers.d.ts +1 -1
  11. package/src/conversion/conversionhelpers.js +1 -1
  12. package/src/conversion/downcastdispatcher.d.ts +63 -69
  13. package/src/conversion/downcastdispatcher.js +16 -16
  14. package/src/conversion/downcasthelpers.d.ts +94 -83
  15. package/src/conversion/downcasthelpers.js +63 -53
  16. package/src/conversion/mapper.d.ts +27 -27
  17. package/src/conversion/mapper.js +15 -15
  18. package/src/conversion/modelconsumable.d.ts +26 -26
  19. package/src/conversion/modelconsumable.js +23 -23
  20. package/src/conversion/upcastdispatcher.d.ts +33 -32
  21. package/src/conversion/upcastdispatcher.js +19 -19
  22. package/src/conversion/upcasthelpers.d.ts +46 -38
  23. package/src/conversion/upcasthelpers.js +33 -24
  24. package/src/conversion/viewconsumable.d.ts +50 -45
  25. package/src/conversion/viewconsumable.js +32 -27
  26. package/src/dataprocessor/basichtmlwriter.d.ts +4 -2
  27. package/src/dataprocessor/basichtmlwriter.js +3 -1
  28. package/src/dataprocessor/dataprocessor.d.ts +7 -6
  29. package/src/dataprocessor/htmldataprocessor.d.ts +10 -10
  30. package/src/dataprocessor/htmldataprocessor.js +6 -6
  31. package/src/dataprocessor/htmlwriter.d.ts +1 -1
  32. package/src/dataprocessor/xmldataprocessor.d.ts +10 -10
  33. package/src/dataprocessor/xmldataprocessor.js +6 -6
  34. package/src/dev-utils/model.d.ts +25 -26
  35. package/src/dev-utils/model.js +35 -36
  36. package/src/dev-utils/operationreplayer.d.ts +5 -3
  37. package/src/dev-utils/operationreplayer.js +4 -2
  38. package/src/dev-utils/utils.d.ts +8 -0
  39. package/src/dev-utils/utils.js +8 -0
  40. package/src/dev-utils/view.d.ts +66 -63
  41. package/src/dev-utils/view.js +144 -134
  42. package/src/index.d.ts +135 -106
  43. package/src/index.js +120 -71
  44. package/src/legacyerrors.d.ts +5 -0
  45. package/src/legacyerrors.js +17 -0
  46. package/src/model/batch.d.ts +2 -15
  47. package/src/model/batch.js +1 -23
  48. package/src/model/differ.d.ts +54 -31
  49. package/src/model/differ.js +15 -15
  50. package/src/model/document.d.ts +31 -31
  51. package/src/model/document.js +13 -13
  52. package/src/model/documentfragment.d.ts +45 -45
  53. package/src/model/documentfragment.js +40 -40
  54. package/src/model/documentselection.d.ts +92 -92
  55. package/src/model/documentselection.js +71 -70
  56. package/src/model/element.d.ts +31 -31
  57. package/src/model/element.js +29 -29
  58. package/src/model/history.d.ts +3 -3
  59. package/src/model/history.js +2 -2
  60. package/src/model/item.d.ts +4 -5
  61. package/src/model/liveposition.d.ts +31 -31
  62. package/src/model/liveposition.js +18 -18
  63. package/src/model/liverange.d.ts +42 -38
  64. package/src/model/liverange.js +17 -16
  65. package/src/model/markercollection.d.ts +41 -40
  66. package/src/model/markercollection.js +22 -20
  67. package/src/model/model.d.ts +82 -81
  68. package/src/model/model.js +54 -54
  69. package/src/model/node.d.ts +48 -48
  70. package/src/model/node.js +31 -31
  71. package/src/model/nodelist.d.ts +17 -17
  72. package/src/model/nodelist.js +11 -11
  73. package/src/model/operation/attributeoperation.d.ts +10 -10
  74. package/src/model/operation/attributeoperation.js +7 -7
  75. package/src/model/operation/detachoperation.d.ts +11 -9
  76. package/src/model/operation/detachoperation.js +8 -6
  77. package/src/model/operation/insertoperation.d.ts +13 -13
  78. package/src/model/operation/insertoperation.js +15 -15
  79. package/src/model/operation/markeroperation.d.ts +12 -12
  80. package/src/model/operation/markeroperation.js +5 -5
  81. package/src/model/operation/mergeoperation.d.ts +16 -16
  82. package/src/model/operation/mergeoperation.js +18 -18
  83. package/src/model/operation/moveoperation.d.ts +16 -16
  84. package/src/model/operation/moveoperation.js +18 -15
  85. package/src/model/operation/nooperation.d.ts +4 -4
  86. package/src/model/operation/nooperation.js +2 -2
  87. package/src/model/operation/operation.d.ts +10 -10
  88. package/src/model/operation/operation.js +5 -5
  89. package/src/model/operation/operationfactory.d.ts +4 -4
  90. package/src/model/operation/operationfactory.js +12 -12
  91. package/src/model/operation/renameoperation.d.ts +10 -10
  92. package/src/model/operation/renameoperation.js +7 -7
  93. package/src/model/operation/rootattributeoperation.d.ts +12 -12
  94. package/src/model/operation/rootattributeoperation.js +8 -8
  95. package/src/model/operation/rootoperation.d.ts +8 -8
  96. package/src/model/operation/rootoperation.js +3 -3
  97. package/src/model/operation/splitoperation.d.ts +17 -17
  98. package/src/model/operation/splitoperation.js +19 -19
  99. package/src/model/operation/transform.d.ts +11 -8
  100. package/src/model/operation/transform.js +66 -49
  101. package/src/model/operation/utils.d.ts +24 -23
  102. package/src/model/operation/utils.js +20 -20
  103. package/src/model/position.d.ts +101 -97
  104. package/src/model/position.js +69 -64
  105. package/src/model/range.d.ts +90 -90
  106. package/src/model/range.js +87 -87
  107. package/src/model/rootelement.d.ts +11 -11
  108. package/src/model/rootelement.js +9 -9
  109. package/src/model/schema.d.ts +158 -154
  110. package/src/model/schema.js +93 -90
  111. package/src/model/selection.d.ts +73 -73
  112. package/src/model/selection.js +62 -62
  113. package/src/model/text.d.ts +11 -10
  114. package/src/model/text.js +11 -10
  115. package/src/model/textproxy.d.ts +39 -38
  116. package/src/model/textproxy.js +31 -30
  117. package/src/model/treewalker.d.ts +37 -37
  118. package/src/model/treewalker.js +14 -14
  119. package/src/model/typecheckable.d.ts +45 -45
  120. package/src/model/typecheckable.js +1 -1
  121. package/src/model/utils/autoparagraphing.d.ts +7 -7
  122. package/src/model/utils/deletecontent.d.ts +7 -5
  123. package/src/model/utils/deletecontent.js +13 -11
  124. package/src/model/utils/getselectedcontent.d.ts +6 -5
  125. package/src/model/utils/getselectedcontent.js +2 -1
  126. package/src/model/utils/insertcontent.d.ts +9 -8
  127. package/src/model/utils/insertcontent.js +41 -40
  128. package/src/model/utils/insertobject.d.ts +9 -9
  129. package/src/model/utils/insertobject.js +4 -4
  130. package/src/model/utils/modifyselection.d.ts +5 -4
  131. package/src/model/utils/modifyselection.js +12 -11
  132. package/src/model/utils/selection-post-fixer.d.ts +12 -8
  133. package/src/model/utils/selection-post-fixer.js +15 -11
  134. package/src/model/writer.d.ts +102 -101
  135. package/src/model/writer.js +99 -98
  136. package/src/view/attributeelement.d.ts +29 -29
  137. package/src/view/attributeelement.js +25 -25
  138. package/src/view/containerelement.d.ts +16 -15
  139. package/src/view/containerelement.js +15 -14
  140. package/src/view/datatransfer.d.ts +7 -7
  141. package/src/view/datatransfer.js +1 -1
  142. package/src/view/document.d.ts +25 -25
  143. package/src/view/document.js +15 -15
  144. package/src/view/documentfragment.d.ts +21 -21
  145. package/src/view/documentfragment.js +14 -14
  146. package/src/view/documentselection.d.ts +65 -63
  147. package/src/view/documentselection.js +27 -25
  148. package/src/view/domconverter.d.ts +94 -89
  149. package/src/view/domconverter.js +78 -73
  150. package/src/view/downcastwriter.d.ts +185 -181
  151. package/src/view/downcastwriter.js +222 -210
  152. package/src/view/editableelement.d.ts +13 -13
  153. package/src/view/editableelement.js +8 -8
  154. package/src/view/element.d.ts +75 -74
  155. package/src/view/element.js +58 -58
  156. package/src/view/elementdefinition.d.ts +3 -4
  157. package/src/view/emptyelement.d.ts +13 -13
  158. package/src/view/emptyelement.js +13 -13
  159. package/src/view/filler.d.ts +14 -3
  160. package/src/view/filler.js +12 -1
  161. package/src/view/item.d.ts +4 -5
  162. package/src/view/matcher.d.ts +22 -19
  163. package/src/view/matcher.js +6 -6
  164. package/src/view/node.d.ts +33 -33
  165. package/src/view/node.js +9 -9
  166. package/src/view/observer/arrowkeysobserver.d.ts +10 -10
  167. package/src/view/observer/arrowkeysobserver.js +5 -5
  168. package/src/view/observer/bubblingemittermixin.d.ts +5 -5
  169. package/src/view/observer/bubblingemittermixin.js +2 -9
  170. package/src/view/observer/bubblingeventinfo.d.ts +9 -9
  171. package/src/view/observer/bubblingeventinfo.js +1 -1
  172. package/src/view/observer/clickobserver.d.ts +8 -8
  173. package/src/view/observer/clickobserver.js +4 -4
  174. package/src/view/observer/compositionobserver.d.ts +19 -19
  175. package/src/view/observer/compositionobserver.js +6 -6
  176. package/src/view/observer/domeventdata.d.ts +9 -9
  177. package/src/view/observer/domeventdata.js +2 -2
  178. package/src/view/observer/domeventobserver.d.ts +3 -3
  179. package/src/view/observer/domeventobserver.js +5 -5
  180. package/src/view/observer/fakeselectionobserver.d.ts +9 -9
  181. package/src/view/observer/fakeselectionobserver.js +8 -8
  182. package/src/view/observer/focusobserver.d.ts +16 -16
  183. package/src/view/observer/focusobserver.js +7 -7
  184. package/src/view/observer/inputobserver.d.ts +18 -18
  185. package/src/view/observer/inputobserver.js +5 -5
  186. package/src/view/observer/keyobserver.d.ts +11 -11
  187. package/src/view/observer/keyobserver.js +3 -3
  188. package/src/view/observer/mouseobserver.d.ts +16 -16
  189. package/src/view/observer/mouseobserver.js +3 -3
  190. package/src/view/observer/mutationobserver.d.ts +21 -21
  191. package/src/view/observer/mutationobserver.js +7 -7
  192. package/src/view/observer/observer.d.ts +12 -12
  193. package/src/view/observer/observer.js +6 -6
  194. package/src/view/observer/selectionobserver.d.ts +33 -33
  195. package/src/view/observer/selectionobserver.js +14 -14
  196. package/src/view/observer/tabobserver.d.ts +10 -10
  197. package/src/view/observer/tabobserver.js +5 -5
  198. package/src/view/observer/touchobserver.d.ts +13 -13
  199. package/src/view/observer/touchobserver.js +3 -3
  200. package/src/view/placeholder.d.ts +21 -21
  201. package/src/view/placeholder.js +23 -23
  202. package/src/view/position.d.ts +49 -49
  203. package/src/view/position.js +42 -42
  204. package/src/view/range.d.ts +76 -74
  205. package/src/view/range.js +67 -65
  206. package/src/view/rawelement.d.ts +19 -19
  207. package/src/view/rawelement.js +16 -16
  208. package/src/view/renderer.d.ts +14 -14
  209. package/src/view/renderer.js +7 -7
  210. package/src/view/rooteditableelement.d.ts +8 -7
  211. package/src/view/rooteditableelement.js +7 -6
  212. package/src/view/selection.d.ts +66 -64
  213. package/src/view/selection.js +50 -48
  214. package/src/view/styles/background.d.ts +2 -2
  215. package/src/view/styles/background.js +9 -9
  216. package/src/view/styles/border.d.ts +2 -2
  217. package/src/view/styles/border.js +13 -13
  218. package/src/view/styles/margin.d.ts +2 -2
  219. package/src/view/styles/margin.js +5 -5
  220. package/src/view/styles/padding.d.ts +2 -2
  221. package/src/view/styles/padding.js +5 -5
  222. package/src/view/styles/utils.d.ts +24 -24
  223. package/src/view/styles/utils.js +25 -25
  224. package/src/view/stylesmap.d.ts +28 -32
  225. package/src/view/stylesmap.js +52 -39
  226. package/src/view/text.d.ts +11 -11
  227. package/src/view/text.js +10 -10
  228. package/src/view/textproxy.d.ts +33 -32
  229. package/src/view/textproxy.js +23 -22
  230. package/src/view/tokenlist.d.ts +14 -14
  231. package/src/view/tokenlist.js +10 -10
  232. package/src/view/treewalker.d.ts +42 -40
  233. package/src/view/treewalker.js +36 -35
  234. package/src/view/typecheckable.d.ts +76 -75
  235. package/src/view/typecheckable.js +1 -1
  236. package/src/view/uielement.d.ts +22 -21
  237. package/src/view/uielement.js +17 -16
  238. package/src/view/upcastwriter.d.ts +70 -70
  239. package/src/view/upcastwriter.js +42 -42
  240. package/src/view/view.d.ts +70 -69
  241. package/src/view/view.js +56 -55
@@ -5,24 +5,24 @@
5
5
  /**
6
6
  * @module engine/model/model
7
7
  */
8
- import Batch from './batch.js';
9
- import Document from './document.js';
10
- import MarkerCollection from './markercollection.js';
11
- import ModelPosition from './position.js';
12
- import ModelRange from './range.js';
13
- import ModelSelection from './selection.js';
14
- import OperationFactory from './operation/operationfactory.js';
15
- import DocumentSelection from './documentselection.js';
16
- import Schema from './schema.js';
17
- import Writer from './writer.js';
18
- import Node from './node.js';
8
+ import { Batch } from './batch.js';
9
+ import { ModelDocument } from './document.js';
10
+ import { MarkerCollection } from './markercollection.js';
11
+ import { ModelPosition } from './position.js';
12
+ import { ModelRange } from './range.js';
13
+ import { ModelSelection } from './selection.js';
14
+ import { OperationFactory } from './operation/operationfactory.js';
15
+ import { ModelDocumentSelection } from './documentselection.js';
16
+ import { ModelSchema } from './schema.js';
17
+ import { ModelWriter } from './writer.js';
18
+ import { ModelNode } from './node.js';
19
19
  import { autoParagraphEmptyRoots } from './utils/autoparagraphing.js';
20
20
  import { injectSelectionPostFixer } from './utils/selection-post-fixer.js';
21
- import deleteContent from './utils/deletecontent.js';
22
- import getSelectedContent from './utils/getselectedcontent.js';
23
- import insertContent from './utils/insertcontent.js';
24
- import insertObject from './utils/insertobject.js';
25
- import modifySelection from './utils/modifyselection.js';
21
+ import { deleteContent } from './utils/deletecontent.js';
22
+ import { getSelectedContent } from './utils/getselectedcontent.js';
23
+ import { insertContent } from './utils/insertcontent.js';
24
+ import { insertObject } from './utils/insertobject.js';
25
+ import { modifySelection } from './utils/modifyselection.js';
26
26
  import { CKEditorError, ObservableMixin } from '@ckeditor/ckeditor5-utils';
27
27
  // @if CK_DEBUG_ENGINE // const { dumpTrees, initDocumentDumping } = require( '../dev-utils/utils' );
28
28
  // @if CK_DEBUG_ENGINE // const { OperationReplayer } = require( '../dev-utils/operationreplayer' ).default;
@@ -30,7 +30,7 @@ import { CKEditorError, ObservableMixin } from '@ckeditor/ckeditor5-utils';
30
30
  * Editor's data model. Read about the model in the
31
31
  * {@glink framework/architecture/editing-engine engine architecture} guide.
32
32
  */
33
- export default class Model extends /* #__PURE__ */ ObservableMixin() {
33
+ export class Model extends /* #__PURE__ */ ObservableMixin() {
34
34
  /**
35
35
  * Model's marker collection.
36
36
  */
@@ -57,8 +57,8 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
57
57
  constructor() {
58
58
  super();
59
59
  this.markers = new MarkerCollection();
60
- this.document = new Document(this);
61
- this.schema = new Schema();
60
+ this.document = new ModelDocument(this);
61
+ this.schema = new ModelSchema();
62
62
  this._pendingChanges = [];
63
63
  this._currentWriter = null;
64
64
  ['deleteContent', 'modifySelection', 'getSelectedContent', 'applyOperation']
@@ -142,7 +142,7 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
142
142
  /**
143
143
  * The `change()` method is the primary way of changing the model. You should use it to modify all document nodes
144
144
  * (including detached nodes – i.e. nodes not added to the {@link module:engine/model/model~Model#document model document}),
145
- * the {@link module:engine/model/document~Document#selection document's selection}, and
145
+ * the {@link module:engine/model/document~ModelDocument#selection document's selection}, and
146
146
  * {@link module:engine/model/model~Model#markers model markers}.
147
147
  *
148
148
  * ```ts
@@ -226,7 +226,7 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
226
226
  * {@link module:engine/model/operation/operation~Operation operations} to the model.
227
227
  *
228
228
  * This is a low-level way of changing the model. It is exposed for very specific use cases (like the undo feature).
229
- * Normally, to modify the model, you will want to use {@link module:engine/model/writer~Writer `Writer`}.
229
+ * Normally, to modify the model, you will want to use {@link module:engine/model/writer~ModelWriter `Writer`}.
230
230
  * See also {@glink framework/architecture/editing-engine#changing-the-model Changing the model} section
231
231
  * of the {@glink framework/architecture/editing-engine Editing architecture} guide.
232
232
  *
@@ -260,9 +260,9 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
260
260
  * It can split elements, merge them, wrap bare text nodes with paragraphs, etc. – just like the
261
261
  * pasting feature should do.
262
262
  *
263
- * For lower-level methods see {@link module:engine/model/writer~Writer `Writer`}.
263
+ * For lower-level methods see {@link module:engine/model/writer~ModelWriter `Writer`}.
264
264
  *
265
- * This method, unlike {@link module:engine/model/writer~Writer `Writer`}'s methods, does not have to be used
265
+ * This method, unlike {@link module:engine/model/writer~ModelWriter `Writer`}'s methods, does not have to be used
266
266
  * inside a {@link #change `change()` block}.
267
267
  *
268
268
  * # Conversion and schema
@@ -349,7 +349,7 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
349
349
  * ```
350
350
  *
351
351
  * If you want the document selection to be moved to the inserted content, use the
352
- * {@link module:engine/model/writer~Writer#setSelection `setSelection()`} method of the writer after inserting
352
+ * {@link module:engine/model/writer~ModelWriter#setSelection `setSelection()`} method of the writer after inserting
353
353
  * the content:
354
354
  *
355
355
  * ```ts
@@ -364,7 +364,7 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
364
364
  * } );
365
365
  * ```
366
366
  *
367
- * If an instance of the {@link module:engine/model/selection~Selection model selection} is passed as `selectable`,
367
+ * If an instance of the {@link module:engine/model/selection~ModelSelection model selection} is passed as `selectable`,
368
368
  * the new content will be inserted at the passed selection (instead of document selection):
369
369
  *
370
370
  * ```ts
@@ -408,8 +408,8 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
408
408
  * # Notes
409
409
  *
410
410
  * * If you want to insert a non-object content, see {@link #insertContent} instead.
411
- * * For lower-level API, see {@link module:engine/model/writer~Writer `Writer`}.
412
- * * Unlike {@link module:engine/model/writer~Writer `Writer`}, this method does not have to be used inside
411
+ * * For lower-level API, see {@link module:engine/model/writer~ModelWriter `Writer`}.
412
+ * * Unlike {@link module:engine/model/writer~ModelWriter `Writer`}, this method does not have to be used inside
413
413
  * a {@link #change `change()` block}.
414
414
  * * Inserting object into the model is not enough to make CKEditor 5 render that content to the user.
415
415
  * CKEditor 5 implements a model-view-controller architecture and what `model.insertObject()` does
@@ -460,7 +460,7 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
460
460
  *
461
461
  * @param element An object to be inserted into the model document.
462
462
  * @param selectable A selectable where the content should be inserted. If not specified, the current
463
- * {@link module:engine/model/document~Document#selection document selection} will be used instead.
463
+ * {@link module:engine/model/document~ModelDocument#selection document selection} will be used instead.
464
464
  * @param placeOrOffset Specifies the exact place or offset for the insertion to take place, relative to `selectable`.
465
465
  * @param options Additional options.
466
466
  * @param options.findOptimalPosition An option that, when set, adjusts the insertion position (relative to
@@ -471,7 +471,7 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
471
471
  *
472
472
  * Note that this option only works for block objects. Inline objects are inserted into text and do not split blocks.
473
473
  * @param options.setSelection An option that, when set, moves the
474
- * {@link module:engine/model/document~Document#selection document selection} after inserting the object.
474
+ * {@link module:engine/model/document~ModelDocument#selection document selection} after inserting the object.
475
475
  * * When `'on'`, the document selection will be set on the inserted object.
476
476
  * * When `'after'`, the document selection will move to the closest text node after the inserted object. If there is no
477
477
  * such text node, a paragraph will be created and the document selection will be moved inside it.
@@ -503,7 +503,7 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
503
503
  * * `<heading1>x^y</heading1>` with the option disabled (`leaveUnmerged == false`)
504
504
  * * `<heading1>x^</heading1><paragraph>y</paragraph>` with enabled (`leaveUnmerged == true`).
505
505
  *
506
- * Note: {@link module:engine/model/schema~Schema#isObject object} and {@link module:engine/model/schema~Schema#isLimit limit}
506
+ * Note: {@link module:engine/model/schema~ModelSchema#isObject object} and {@link module:engine/model/schema~ModelSchema#isLimit limit}
507
507
  * elements will not be merged.
508
508
  *
509
509
  * @param options.doNotResetEntireContent Whether to skip replacing the entire content with a
@@ -595,14 +595,14 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
595
595
  return getSelectedContent(this, selection);
596
596
  }
597
597
  /**
598
- * Checks whether the given {@link module:engine/model/range~Range range} or
599
- * {@link module:engine/model/element~Element element} has any meaningful content.
598
+ * Checks whether the given {@link module:engine/model/range~ModelRange range} or
599
+ * {@link module:engine/model/element~ModelElement element} has any meaningful content.
600
600
  *
601
601
  * Meaningful content is:
602
602
  *
603
603
  * * any text node (`options.ignoreWhitespaces` allows controlling whether this text node must also contain
604
604
  * any non-whitespace characters),
605
- * * or any {@link module:engine/model/schema~Schema#isContent content element},
605
+ * * or any {@link module:engine/model/schema~ModelSchema#isContent content element},
606
606
  * * or any {@link module:engine/model/markercollection~Marker marker} which
607
607
  * {@link module:engine/model/markercollection~Marker#_affectsData affects data}.
608
608
  *
@@ -654,7 +654,7 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
654
654
  *
655
655
  * This method is decorated. Although this method accepts any parameter of `Selectable` type, the
656
656
  * {@link ~Model#event:canEditAt `canEditAt` event} is fired with `selectable` normalized to an instance of
657
- * {@link module:engine/model/selection~Selection} or {@link module:engine/model/documentselection~DocumentSelection}
657
+ * {@link module:engine/model/selection~ModelSelection} or {@link module:engine/model/documentselection~ModelDocumentSelection}
658
658
  *
659
659
  * @fires canEditAt
660
660
  */
@@ -666,11 +666,11 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
666
666
  * Creates a position from the given root and path in that root.
667
667
  *
668
668
  * Note: This method is also available as
669
- * {@link module:engine/model/writer~Writer#createPositionFromPath `Writer#createPositionFromPath()`}.
669
+ * {@link module:engine/model/writer~ModelWriter#createPositionFromPath `Writer#createPositionFromPath()`}.
670
670
  *
671
671
  * @param root Root of the position.
672
- * @param path Position path. See {@link module:engine/model/position~Position#path}.
673
- * @param stickiness Position stickiness. See {@link module:engine/model/position~PositionStickiness}.
672
+ * @param path Position path. See {@link module:engine/model/position~ModelPosition#path}.
673
+ * @param stickiness Position stickiness. See {@link module:engine/model/position~ModelPositionStickiness}.
674
674
  */
675
675
  createPositionFromPath(root, path, stickiness) {
676
676
  return new ModelPosition(root, path, stickiness);
@@ -678,10 +678,10 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
678
678
  /**
679
679
  * Creates position at the given location. The location can be specified as:
680
680
  *
681
- * * a {@link module:engine/model/position~Position position},
681
+ * * a {@link module:engine/model/position~ModelPosition position},
682
682
  * * a parent element and offset in that element,
683
683
  * * a parent element and `'end'` (the position will be set at the end of that element),
684
- * * a {@link module:engine/model/item~Item model item} and `'before'` or `'after'`
684
+ * * a {@link module:engine/model/item~ModelItem model item} and `'before'` or `'after'`
685
685
  * (the position will be set before or after the given model item).
686
686
  *
687
687
  * This method is a shortcut to other factory methods such as:
@@ -690,19 +690,19 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
690
690
  * * {@link module:engine/model/model~Model#createPositionAfter `createPositionAfter()`}.
691
691
  *
692
692
  * Note: This method is also available as
693
- * {@link module:engine/model/writer~Writer#createPositionAt `Writer#createPositionAt()`},
693
+ * {@link module:engine/model/writer~ModelWriter#createPositionAt `Writer#createPositionAt()`},
694
694
  *
695
695
  * @param itemOrPosition
696
- * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/model/item~Item model item}.
696
+ * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/model/item~ModelItem model item}.
697
697
  */
698
698
  createPositionAt(itemOrPosition, offset) {
699
699
  return ModelPosition._createAt(itemOrPosition, offset);
700
700
  }
701
701
  /**
702
- * Creates a new position after the given {@link module:engine/model/item~Item model item}.
702
+ * Creates a new position after the given {@link module:engine/model/item~ModelItem model item}.
703
703
  *
704
704
  * Note: This method is also available as
705
- * {@link module:engine/model/writer~Writer#createPositionAfter `Writer#createPositionAfter()`}.
705
+ * {@link module:engine/model/writer~ModelWriter#createPositionAfter `Writer#createPositionAfter()`}.
706
706
  *
707
707
  * @param item Item after which the position should be placed.
708
708
  */
@@ -710,10 +710,10 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
710
710
  return ModelPosition._createAfter(item);
711
711
  }
712
712
  /**
713
- * Creates a new position before the given {@link module:engine/model/item~Item model item}.
713
+ * Creates a new position before the given {@link module:engine/model/item~ModelItem model item}.
714
714
  *
715
715
  * Note: This method is also available as
716
- * {@link module:engine/model/writer~Writer#createPositionBefore `Writer#createPositionBefore()`}.
716
+ * {@link module:engine/model/writer~ModelWriter#createPositionBefore `Writer#createPositionBefore()`}.
717
717
  *
718
718
  * @param item Item before which the position should be placed.
719
719
  */
@@ -724,7 +724,7 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
724
724
  * Creates a range spanning from the `start` position to the `end` position.
725
725
  *
726
726
  * Note: This method is also available as
727
- * {@link module:engine/model/writer~Writer#createRange `Writer#createRange()`}:
727
+ * {@link module:engine/model/writer~ModelWriter#createRange `Writer#createRange()`}:
728
728
  *
729
729
  * ```ts
730
730
  * model.change( writer => {
@@ -743,7 +743,7 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
743
743
  * that element and ends after the last child of that element.
744
744
  *
745
745
  * Note: This method is also available as
746
- * {@link module:engine/model/writer~Writer#createRangeIn `Writer#createRangeIn()`}:
746
+ * {@link module:engine/model/writer~ModelWriter#createRangeIn `Writer#createRangeIn()`}:
747
747
  *
748
748
  * ```ts
749
749
  * model.change( writer => {
@@ -757,10 +757,10 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
757
757
  return ModelRange._createIn(element);
758
758
  }
759
759
  /**
760
- * Creates a range that starts before the given {@link module:engine/model/item~Item model item} and ends after it.
760
+ * Creates a range that starts before the given {@link module:engine/model/item~ModelItem model item} and ends after it.
761
761
  *
762
762
  * Note: This method is also available on `writer` instance as
763
- * {@link module:engine/model/writer~Writer#createRangeOn `Writer.createRangeOn()`}:
763
+ * {@link module:engine/model/writer~ModelWriter#createRangeOn `Writer.createRangeOn()`}:
764
764
  *
765
765
  * ```ts
766
766
  * model.change( writer => {
@@ -800,7 +800,7 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
800
800
  return OperationFactory.fromJSON(json, this.document);
801
801
  }
802
802
  /**
803
- * Removes all events listeners set by model instance and destroys {@link module:engine/model/document~Document}.
803
+ * Removes all events listeners set by model instance and destroys {@link module:engine/model/document~ModelDocument}.
804
804
  */
805
805
  destroy() {
806
806
  this.document.destroy();
@@ -817,7 +817,7 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
817
817
  while (this._pendingChanges.length) {
818
818
  // Create a new writer using batch instance created for this chain of changes.
819
819
  const currentBatch = this._pendingChanges[0].batch;
820
- this._currentWriter = new Writer(this, currentBatch);
820
+ this._currentWriter = new ModelWriter(this, currentBatch);
821
821
  // Execute changes callback and gather the returned value.
822
822
  const callbackReturnValue = this._pendingChanges[0].callback(this._currentWriter);
823
823
  ret.push(callbackReturnValue);
@@ -835,16 +835,16 @@ export default class Model extends /* #__PURE__ */ ObservableMixin() {
835
835
  }
836
836
  }
837
837
  /**
838
- * Normalizes a selectable to a Selection or DocumentSelection.
838
+ * Normalizes a selectable to a Selection or ModelDocumentSelection.
839
839
  */
840
840
  function normalizeSelectable(selectable, placeOrOffset) {
841
841
  if (!selectable) {
842
842
  return;
843
843
  }
844
- if (selectable instanceof ModelSelection || selectable instanceof DocumentSelection) {
844
+ if (selectable instanceof ModelSelection || selectable instanceof ModelDocumentSelection) {
845
845
  return selectable;
846
846
  }
847
- if (selectable instanceof Node) {
847
+ if (selectable instanceof ModelNode) {
848
848
  if (placeOrOffset || placeOrOffset === 0) {
849
849
  return new ModelSelection(selectable, placeOrOffset);
850
850
  }
@@ -5,10 +5,10 @@
5
5
  /**
6
6
  * @module engine/model/node
7
7
  */
8
- import TypeCheckable from './typecheckable.js';
9
- import type Document from './document.js';
10
- import type DocumentFragment from './documentfragment.js';
11
- import type Element from './element.js';
8
+ import { ModelTypeCheckable } from './typecheckable.js';
9
+ import { type ModelDocument } from './document.js';
10
+ import { type ModelDocumentFragment } from './documentfragment.js';
11
+ import { type ModelElement } from './element.js';
12
12
  /**
13
13
  * Model node. Most basic structure of model tree.
14
14
  *
@@ -16,12 +16,12 @@ import type Element from './element.js';
16
16
  *
17
17
  * **Note:** If a node is detached from the model tree, you can manipulate it using it's API.
18
18
  * However, it is **very important** that nodes already attached to model tree should be only changed through
19
- * {@link module:engine/model/writer~Writer Writer API}.
19
+ * {@link module:engine/model/writer~ModelWriter Writer API}.
20
20
  *
21
- * Changes done by `Node` methods, like {@link module:engine/model/element~Element#_insertChild _insertChild} or
22
- * {@link module:engine/model/node~Node#_setAttribute _setAttribute}
21
+ * Changes done by `Node` methods, like {@link module:engine/model/element~ModelElement#_insertChild _insertChild} or
22
+ * {@link module:engine/model/node~ModelNode#_setAttribute _setAttribute}
23
23
  * do not generate {@link module:engine/model/operation/operation~Operation operations}
24
- * which are essential for correct editor work if you modify nodes in {@link module:engine/model/document~Document document} root.
24
+ * which are essential for correct editor work if you modify nodes in {@link module:engine/model/document~ModelDocument document} root.
25
25
  *
26
26
  * The flow of working on `Node` (and classes that inherits from it) is as such:
27
27
  * 1. You can create a `Node` instance, modify it using it's API.
@@ -29,23 +29,23 @@ import type Element from './element.js';
29
29
  * 3. Change `Node` that was already added to the model using `Batch` API.
30
30
  *
31
31
  * Similarly, you cannot use `Batch` API on a node that has not been added to the model tree, with the exception
32
- * of {@link module:engine/model/writer~Writer#insert inserting} that node to the model tree.
32
+ * of {@link module:engine/model/writer~ModelWriter#insert inserting} that node to the model tree.
33
33
  *
34
- * Be aware that using {@link module:engine/model/writer~Writer#remove remove from Batch API} does not allow to use `Node` API because
34
+ * Be aware that using {@link module:engine/model/writer~ModelWriter#remove remove from Batch API} does not allow to use `Node` API because
35
35
  * the information about `Node` is still kept in model document.
36
36
  *
37
- * In case of {@link module:engine/model/element~Element element node}, adding and removing children also counts as changing a node and
37
+ * In case of {@link module:engine/model/element~ModelElement element node}, adding and removing children also counts as changing a node and
38
38
  * follows same rules.
39
39
  */
40
- export default abstract class Node extends TypeCheckable {
40
+ export declare abstract class ModelNode extends ModelTypeCheckable {
41
41
  /**
42
- * Parent of this node. It could be {@link module:engine/model/element~Element}
43
- * or {@link module:engine/model/documentfragment~DocumentFragment}.
42
+ * Parent of this node. It could be {@link module:engine/model/element~ModelElement}
43
+ * or {@link module:engine/model/documentfragment~ModelDocumentFragment}.
44
44
  * Equals to `null` if the node has no parent.
45
45
  */
46
- readonly parent: Element | DocumentFragment | null;
46
+ readonly parent: ModelElement | ModelDocumentFragment | null;
47
47
  /**
48
- * Unique root name used to identify this root element by {@link module:engine/model/document~Document}.
48
+ * Unique root name used to identify this root element by {@link module:engine/model/document~ModelDocument}.
49
49
  */
50
50
  readonly rootName: string | undefined;
51
51
  /**
@@ -71,11 +71,11 @@ export default abstract class Node extends TypeCheckable {
71
71
  *
72
72
  * @param attrs Node's attributes. See {@link module:utils/tomap~toMap} for a list of accepted values.
73
73
  */
74
- constructor(attrs?: NodeAttributes);
74
+ constructor(attrs?: ModelNodeAttributes);
75
75
  /**
76
- * {@link module:engine/model/document~Document Document} that owns this root element.
76
+ * {@link module:engine/model/document~ModelDocument Document} that owns this root element.
77
77
  */
78
- get document(): Document | null;
78
+ get document(): ModelDocument | null;
79
79
  /**
80
80
  * Index of this node in its parent or `null` if the node has no parent.
81
81
  */
@@ -89,45 +89,45 @@ export default abstract class Node extends TypeCheckable {
89
89
  * Offset size of this node.
90
90
  *
91
91
  * Represents how much "offset space" is occupied by the node in its parent. It is important for
92
- * {@link module:engine/model/position~Position position}. When node has `offsetSize` greater than `1`, position can be placed between
93
- * that node start and end. `offsetSize` greater than `1` is for nodes that represents more than one entity, i.e.
94
- * a {@link module:engine/model/text~Text text node}.
92
+ * {@link module:engine/model/position~ModelPosition position}. When node has `offsetSize` greater
93
+ * than `1`, position can be placed between that node start and end. `offsetSize` greater than `1` is for
94
+ * nodes that represents more than one entity, i.e. a {@link module:engine/model/text~ModelText text node}.
95
95
  */
96
96
  get offsetSize(): number;
97
97
  /**
98
98
  * Offset at which this node ends in its parent. It is equal to the sum of this node's
99
- * {@link module:engine/model/node~Node#startOffset start offset} and {@link #offsetSize offset size}.
99
+ * {@link module:engine/model/node~ModelNode#startOffset start offset} and {@link #offsetSize offset size}.
100
100
  * Equals to `null` if the node has no parent.
101
101
  */
102
102
  get endOffset(): number | null;
103
103
  /**
104
104
  * Node's next sibling or `null` if the node is a last child of it's parent or if the node has no parent.
105
105
  */
106
- get nextSibling(): Node | null;
106
+ get nextSibling(): ModelNode | null;
107
107
  /**
108
108
  * Node's previous sibling or `null` if the node is a first child of it's parent or if the node has no parent.
109
109
  */
110
- get previousSibling(): Node | null;
110
+ get previousSibling(): ModelNode | null;
111
111
  /**
112
112
  * The top-most ancestor of the node. If node has no parent it is the root itself. If the node is a part
113
- * of {@link module:engine/model/documentfragment~DocumentFragment}, it's `root` is equal to that `DocumentFragment`.
113
+ * of {@link module:engine/model/documentfragment~ModelDocumentFragment}, it's `root` is equal to that `DocumentFragment`.
114
114
  */
115
- get root(): Node | DocumentFragment;
115
+ get root(): ModelNode | ModelDocumentFragment;
116
116
  /**
117
117
  * Returns `true` if the node is inside a document root that is attached to the document.
118
118
  */
119
119
  isAttached(): boolean;
120
120
  /**
121
121
  * Gets path to the node. The path is an array containing starting offsets of consecutive ancestors of this node,
122
- * beginning from {@link module:engine/model/node~Node#root root}, down to this node's starting offset. The path can be used to
123
- * create {@link module:engine/model/position~Position Position} instance.
122
+ * beginning from {@link module:engine/model/node~ModelNode#root root}, down to this node's starting offset. The path can be used to
123
+ * create {@link module:engine/model/position~ModelPosition Position} instance.
124
124
  *
125
125
  * ```ts
126
126
  * const abc = new Text( 'abc' );
127
127
  * const foo = new Text( 'foo' );
128
- * const h1 = new Element( 'h1', null, new Text( 'header' ) );
129
- * const p = new Element( 'p', null, [ abc, foo ] );
130
- * const div = new Element( 'div', null, [ h1, p ] );
128
+ * const h1 = new ModelElement( 'h1', null, new Text( 'header' ) );
129
+ * const p = new ModelElement( 'p', null, [ abc, foo ] );
130
+ * const div = new ModelElement( 'div', null, [ h1, p ] );
131
131
  * foo.getPath(); // Returns [ 1, 3 ]. `foo` is in `p` which is in `div`. `p` starts at offset 1, while `foo` at 3.
132
132
  * h1.getPath(); // Returns [ 0 ].
133
133
  * div.getPath(); // Returns [].
@@ -146,9 +146,9 @@ export default abstract class Node extends TypeCheckable {
146
146
  getAncestors(options?: {
147
147
  includeSelf?: boolean;
148
148
  parentFirst?: boolean;
149
- }): Array<Node | DocumentFragment>;
149
+ }): Array<ModelNode | ModelDocumentFragment>;
150
150
  /**
151
- * Returns a {@link module:engine/model/element~Element} or {@link module:engine/model/documentfragment~DocumentFragment}
151
+ * Returns a {@link module:engine/model/element~ModelElement} or {@link module:engine/model/documentfragment~ModelDocumentFragment}
152
152
  * which is a common ancestor of both nodes.
153
153
  *
154
154
  * @param node The second node.
@@ -156,23 +156,23 @@ export default abstract class Node extends TypeCheckable {
156
156
  * @param options.includeSelf When set to `true` both nodes will be considered "ancestors" too.
157
157
  * Which means that if e.g. node A is inside B, then their common ancestor will be B.
158
158
  */
159
- getCommonAncestor(node: Node, options?: {
159
+ getCommonAncestor(node: ModelNode, options?: {
160
160
  includeSelf?: boolean;
161
- }): Element | DocumentFragment | null;
161
+ }): ModelElement | ModelDocumentFragment | null;
162
162
  /**
163
163
  * Returns whether this node is before given node. `false` is returned if nodes are in different trees (for example,
164
- * in different {@link module:engine/model/documentfragment~DocumentFragment}s).
164
+ * in different {@link module:engine/model/documentfragment~ModelDocumentFragment}s).
165
165
  *
166
166
  * @param node Node to compare with.
167
167
  */
168
- isBefore(node: Node): boolean;
168
+ isBefore(node: ModelNode): boolean;
169
169
  /**
170
170
  * Returns whether this node is after given node. `false` is returned if nodes are in different trees (for example,
171
- * in different {@link module:engine/model/documentfragment~DocumentFragment}s).
171
+ * in different {@link module:engine/model/documentfragment~ModelDocumentFragment}s).
172
172
  *
173
173
  * @param node Node to compare with.
174
174
  */
175
- isAfter(node: Node): boolean;
175
+ isAfter(node: ModelNode): boolean;
176
176
  /**
177
177
  * Checks if the node has an attribute with given key.
178
178
  *
@@ -210,18 +210,18 @@ export default abstract class Node extends TypeCheckable {
210
210
  * @internal
211
211
  * @returns Node with same attributes as this node.
212
212
  */
213
- _clone(_deep?: boolean): Node;
213
+ _clone(_deep?: boolean): ModelNode;
214
214
  /**
215
215
  * Removes this node from its parent.
216
216
  *
217
217
  * @internal
218
- * @see module:engine/model/writer~Writer#remove
218
+ * @see module:engine/model/writer~ModelWriter#remove
219
219
  */
220
220
  _remove(): void;
221
221
  /**
222
222
  * Sets attribute on the node. If attribute with the same key already is set, it's value is overwritten.
223
223
  *
224
- * @see module:engine/model/writer~Writer#setAttribute
224
+ * @see module:engine/model/writer~ModelWriter#setAttribute
225
225
  * @internal
226
226
  * @param key Key of attribute to set.
227
227
  * @param value Attribute value.
@@ -230,15 +230,15 @@ export default abstract class Node extends TypeCheckable {
230
230
  /**
231
231
  * Removes all attributes from the node and sets given attributes.
232
232
  *
233
- * @see module:engine/model/writer~Writer#setAttributes
233
+ * @see module:engine/model/writer~ModelWriter#setAttributes
234
234
  * @internal
235
235
  * @param attrs Attributes to set. See {@link module:utils/tomap~toMap} for a list of accepted values.
236
236
  */
237
- _setAttributesTo(attrs: NodeAttributes): void;
237
+ _setAttributesTo(attrs: ModelNodeAttributes): void;
238
238
  /**
239
239
  * Removes an attribute with given key from the node.
240
240
  *
241
- * @see module:engine/model/writer~Writer#removeAttribute
241
+ * @see module:engine/model/writer~ModelWriter#removeAttribute
242
242
  * @internal
243
243
  * @param key Key of attribute to remove.
244
244
  * @returns `true` if the attribute was set on the element, `false` otherwise.
@@ -247,7 +247,7 @@ export default abstract class Node extends TypeCheckable {
247
247
  /**
248
248
  * Removes all attributes from the node.
249
249
  *
250
- * @see module:engine/model/writer~Writer#clearAttributes
250
+ * @see module:engine/model/writer~ModelWriter#clearAttributes
251
251
  * @internal
252
252
  */
253
253
  _clearAttributes(): void;
@@ -255,4 +255,4 @@ export default abstract class Node extends TypeCheckable {
255
255
  /**
256
256
  * Node's attributes. See {@link module:utils/tomap~toMap} for a list of accepted values.
257
257
  */
258
- export type NodeAttributes = Record<string, unknown> | Iterable<[string, unknown]>;
258
+ export type ModelNodeAttributes = Record<string, unknown> | Iterable<[string, unknown]>;