@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,26 +5,26 @@
5
5
  /**
6
6
  * @module engine/view/document
7
7
  */
8
- import DocumentSelection from './documentselection.js';
9
- import BubblingEmitterMixin from './observer/bubblingemittermixin.js';
8
+ import { ViewDocumentSelection } from './documentselection.js';
9
+ import { BubblingEmitterMixin } from './observer/bubblingemittermixin.js';
10
10
  import { Collection, ObservableMixin } from '@ckeditor/ckeditor5-utils';
11
11
  // @if CK_DEBUG_ENGINE // const { logDocument } = require( '../dev-utils/utils' );
12
12
  /**
13
13
  * Document class creates an abstract layer over the content editable area, contains a tree of view elements and
14
- * {@link module:engine/view/documentselection~DocumentSelection view selection} associated with this document.
14
+ * {@link module:engine/view/documentselection~ViewDocumentSelection view selection} associated with this document.
15
15
  */
16
- export default class Document extends /* #__PURE__ */ BubblingEmitterMixin(/* #__PURE__ */ ObservableMixin()) {
16
+ export class ViewDocument extends /* #__PURE__ */ BubblingEmitterMixin(/* #__PURE__ */ ObservableMixin()) {
17
17
  /**
18
18
  * Selection done on this document.
19
19
  */
20
20
  selection;
21
21
  /**
22
- * Roots of the view tree. Collection of the {@link module:engine/view/element~Element view elements}.
22
+ * Roots of the view tree. Collection of the {@link module:engine/view/element~ViewElement view elements}.
23
23
  *
24
- * View roots are created as a result of binding between {@link module:engine/view/document~Document#roots} and
25
- * {@link module:engine/model/document~Document#roots} and this is handled by
24
+ * View roots are created as a result of binding between {@link module:engine/view/document~ViewDocument#roots} and
25
+ * {@link module:engine/model/document~ModelDocument#roots} and this is handled by
26
26
  * {@link module:engine/controller/editingcontroller~EditingController}, so to create view root we need to create
27
- * model root using {@link module:engine/model/document~Document#createRoot}.
27
+ * model root using {@link module:engine/model/document~ModelDocument#createRoot}.
28
28
  */
29
29
  roots;
30
30
  /**
@@ -42,7 +42,7 @@ export default class Document extends /* #__PURE__ */ BubblingEmitterMixin(/* #_
42
42
  */
43
43
  constructor(stylesProcessor) {
44
44
  super();
45
- this.selection = new DocumentSelection();
45
+ this.selection = new ViewDocumentSelection();
46
46
  this.roots = new Collection({ idProperty: 'rootName' });
47
47
  this.stylesProcessor = stylesProcessor;
48
48
  this.set('isReadOnly', false);
@@ -51,7 +51,7 @@ export default class Document extends /* #__PURE__ */ BubblingEmitterMixin(/* #_
51
51
  this.set('isComposing', false);
52
52
  }
53
53
  /**
54
- * Gets a {@link module:engine/view/document~Document#roots view root element} with the specified name. If the name is not
54
+ * Gets a {@link module:engine/view/document~ViewDocument#roots view root element} with the specified name. If the name is not
55
55
  * specific "main" root is returned.
56
56
  *
57
57
  * @param name Name of the root.
@@ -65,7 +65,7 @@ export default class Document extends /* #__PURE__ */ BubblingEmitterMixin(/* #_
65
65
  * to the DOM.
66
66
  *
67
67
  * Post-fixers are executed right after all changes from the outermost change block were applied but
68
- * before the {@link module:engine/view/view~View#event:render render event} is fired. If a post-fixer callback made
68
+ * before the {@link module:engine/view/view~EditingView#event:render render event} is fired. If a post-fixer callback made
69
69
  * a change, it should return `true`. When this happens, all post-fixers are fired again to check if something else should
70
70
  * not be fixed in the new document tree state.
71
71
  *
@@ -75,7 +75,7 @@ export default class Document extends /* #__PURE__ */ BubblingEmitterMixin(/* #_
75
75
  * The types of changes which should be safe:
76
76
  *
77
77
  * * adding or removing attribute from elements,
78
- * * changes inside of {@link module:engine/view/uielement~UIElement UI elements},
78
+ * * changes inside of {@link module:engine/view/uielement~ViewUIElement UI elements},
79
79
  * * {@link module:engine/controller/editingcontroller~EditingController#reconvertItem marking some of the model elements to be
80
80
  * re-converted}.
81
81
  *
@@ -84,7 +84,7 @@ export default class Document extends /* #__PURE__ */ BubblingEmitterMixin(/* #_
84
84
  * * you should not add or remove nor wrap or unwrap any view elements,
85
85
  * * you should not change the editor data model in a view post-fixer.
86
86
  *
87
- * As a parameter, a post-fixer callback receives a {@link module:engine/view/downcastwriter~DowncastWriter downcast writer}.
87
+ * As a parameter, a post-fixer callback receives a {@link module:engine/view/downcastwriter~ViewDowncastWriter downcast writer}.
88
88
  *
89
89
  * Typically, a post-fixer will look like this:
90
90
  *
@@ -105,10 +105,10 @@ export default class Document extends /* #__PURE__ */ BubblingEmitterMixin(/* #_
105
105
  * That is because adding a post-fixer does not execute it.
106
106
  * The post-fixer will be executed as soon as any change in the document needs to cause its rendering.
107
107
  * If you want to re-render the editor's view after registering the post-fixer then you should do it manually by calling
108
- * {@link module:engine/view/view~View#forceRender `view.forceRender()`}.
108
+ * {@link module:engine/view/view~EditingView#forceRender `view.forceRender()`}.
109
109
  *
110
110
  * If you need to register a callback which is executed when DOM elements are already updated,
111
- * use {@link module:engine/view/view~View#event:render render event}.
111
+ * use {@link module:engine/view/view~EditingView#event:render render event}.
112
112
  */
113
113
  registerPostFixer(postFixer) {
114
114
  this._postFixers.add(postFixer);
@@ -5,23 +5,23 @@
5
5
  /**
6
6
  * @module engine/view/documentfragment
7
7
  */
8
- import TypeCheckable from './typecheckable.js';
9
- import type { default as Document, ChangeType } from './document.js';
10
- import type Item from './item.js';
11
- import type Node from './node.js';
12
- declare const DocumentFragment_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof TypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
8
+ import { ViewTypeCheckable } from './typecheckable.js';
9
+ import type { ViewDocument, ViewDocumentChangeType } from './document.js';
10
+ import { type ViewItem } from './item.js';
11
+ import { type ViewNode } from './node.js';
12
+ declare const ViewDocumentFragment_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof ViewTypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
13
13
  /**
14
14
  * Document fragment.
15
15
  *
16
16
  * To create a new document fragment instance use the
17
- * {@link module:engine/view/upcastwriter~UpcastWriter#createDocumentFragment `UpcastWriter#createDocumentFragment()`}
17
+ * {@link module:engine/view/upcastwriter~ViewUpcastWriter#createDocumentFragment `ViewUpcastWriter#createDocumentFragment()`}
18
18
  * method.
19
19
  */
20
- export default class DocumentFragment extends /* #__PURE__ */ DocumentFragment_base implements Iterable<Node> {
20
+ export declare class ViewDocumentFragment extends /* #__PURE__ */ ViewDocumentFragment_base implements Iterable<ViewNode> {
21
21
  /**
22
22
  * The document to which this document fragment belongs.
23
23
  */
24
- readonly document: Document;
24
+ readonly document: ViewDocument;
25
25
  /**
26
26
  * Array of child nodes.
27
27
  */
@@ -38,13 +38,13 @@ export default class DocumentFragment extends /* #__PURE__ */ DocumentFragment_b
38
38
  * @param document The document to which this document fragment belongs.
39
39
  * @param children A list of nodes to be inserted into the created document fragment.
40
40
  */
41
- constructor(document: Document, children?: Node | Iterable<Node>);
41
+ constructor(document: ViewDocument, children?: ViewNode | Iterable<ViewNode>);
42
42
  /**
43
43
  * Iterable interface.
44
44
  *
45
45
  * Iterates over nodes added to this document fragment.
46
46
  */
47
- [Symbol.iterator](): Iterator<Node>;
47
+ [Symbol.iterator](): Iterator<ViewNode>;
48
48
  /**
49
49
  * Number of child nodes in this document fragment.
50
50
  */
@@ -79,34 +79,34 @@ export default class DocumentFragment extends /* #__PURE__ */ DocumentFragment_b
79
79
  */
80
80
  getCustomProperties(): Iterable<[string | symbol, unknown]>;
81
81
  /**
82
- * {@link module:engine/view/documentfragment~DocumentFragment#_insertChild Insert} a child node or a list of child nodes at the end
82
+ * {@link module:engine/view/documentfragment~ViewDocumentFragment#_insertChild Insert} a child node or a list of child nodes at the end
83
83
  * and sets the parent of these nodes to this fragment.
84
84
  *
85
85
  * @internal
86
86
  * @param items Items to be inserted.
87
87
  * @returns Number of appended nodes.
88
88
  */
89
- _appendChild(items: Item | string | Iterable<Item | string>): number;
89
+ _appendChild(items: ViewItem | string | Iterable<ViewItem | string>): number;
90
90
  /**
91
91
  * Gets child at the given index.
92
92
  *
93
93
  * @param index Index of child.
94
94
  * @returns Child node.
95
95
  */
96
- getChild(index: number): Node;
96
+ getChild(index: number): ViewNode;
97
97
  /**
98
98
  * Gets index of the given child node. Returns `-1` if child node is not found.
99
99
  *
100
100
  * @param node Child node.
101
101
  * @returns Index of the child node.
102
102
  */
103
- getChildIndex(node: Node): number;
103
+ getChildIndex(node: ViewNode): number;
104
104
  /**
105
105
  * Gets child nodes iterator.
106
106
  *
107
107
  * @returns Child nodes iterator.
108
108
  */
109
- getChildren(): IterableIterator<Node>;
109
+ getChildren(): IterableIterator<ViewNode>;
110
110
  /**
111
111
  * Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to
112
112
  * this fragment.
@@ -116,7 +116,7 @@ export default class DocumentFragment extends /* #__PURE__ */ DocumentFragment_b
116
116
  * @param items Items to be inserted.
117
117
  * @returns Number of inserted nodes.
118
118
  */
119
- _insertChild(index: number, items: Item | string | Iterable<Item | string>): number;
119
+ _insertChild(index: number, items: ViewItem | string | Iterable<ViewItem | string>): number;
120
120
  /**
121
121
  * Removes number of child nodes starting at the given index and set the parent of these nodes to `null`.
122
122
  *
@@ -125,28 +125,28 @@ export default class DocumentFragment extends /* #__PURE__ */ DocumentFragment_b
125
125
  * @param howMany Number of nodes to remove.
126
126
  * @returns The array of removed nodes.
127
127
  */
128
- _removeChildren(index: number, howMany?: number): Array<Node>;
128
+ _removeChildren(index: number, howMany?: number): Array<ViewNode>;
129
129
  /**
130
130
  * @internal
131
131
  * @param type Type of the change.
132
132
  * @param node Changed node.
133
133
  * @param data Additional data.
134
- * @fires module:engine/view/node~Node#event:change
134
+ * @fires module:engine/view/node~ViewNode#event:change
135
135
  */
136
- _fireChange(type: ChangeType, node: Node | DocumentFragment, data?: {
136
+ _fireChange(type: ViewDocumentChangeType, node: ViewNode | ViewDocumentFragment, data?: {
137
137
  index: number;
138
138
  }): void;
139
139
  /**
140
140
  * Sets a custom property. They can be used to add special data to elements.
141
141
  *
142
- * @see module:engine/view/downcastwriter~DowncastWriter#setCustomProperty
142
+ * @see module:engine/view/downcastwriter~ViewDowncastWriter#setCustomProperty
143
143
  * @internal
144
144
  */
145
145
  _setCustomProperty(key: string | symbol, value: unknown): void;
146
146
  /**
147
147
  * Removes the custom property stored under the given key.
148
148
  *
149
- * @see module:engine/view/downcastwriter~DowncastWriter#removeCustomProperty
149
+ * @see module:engine/view/downcastwriter~ViewDowncastWriter#removeCustomProperty
150
150
  * @internal
151
151
  * @returns Returns true if property was removed.
152
152
  */
@@ -5,18 +5,18 @@
5
5
  /**
6
6
  * @module engine/view/documentfragment
7
7
  */
8
- import TypeCheckable from './typecheckable.js';
9
- import Text from './text.js';
10
- import TextProxy from './textproxy.js';
8
+ import { ViewTypeCheckable } from './typecheckable.js';
9
+ import { ViewText } from './text.js';
10
+ import { ViewTextProxy } from './textproxy.js';
11
11
  import { EmitterMixin, isIterable } from '@ckeditor/ckeditor5-utils';
12
12
  /**
13
13
  * Document fragment.
14
14
  *
15
15
  * To create a new document fragment instance use the
16
- * {@link module:engine/view/upcastwriter~UpcastWriter#createDocumentFragment `UpcastWriter#createDocumentFragment()`}
16
+ * {@link module:engine/view/upcastwriter~ViewUpcastWriter#createDocumentFragment `ViewUpcastWriter#createDocumentFragment()`}
17
17
  * method.
18
18
  */
19
- export default class DocumentFragment extends /* #__PURE__ */ EmitterMixin(TypeCheckable) {
19
+ export class ViewDocumentFragment extends /* #__PURE__ */ EmitterMixin(ViewTypeCheckable) {
20
20
  /**
21
21
  * The document to which this document fragment belongs.
22
22
  */
@@ -102,7 +102,7 @@ export default class DocumentFragment extends /* #__PURE__ */ EmitterMixin(TypeC
102
102
  yield* this._customProperties.entries();
103
103
  }
104
104
  /**
105
- * {@link module:engine/view/documentfragment~DocumentFragment#_insertChild Insert} a child node or a list of child nodes at the end
105
+ * {@link module:engine/view/documentfragment~ViewDocumentFragment#_insertChild Insert} a child node or a list of child nodes at the end
106
106
  * and sets the parent of these nodes to this fragment.
107
107
  *
108
108
  * @internal
@@ -183,7 +183,7 @@ export default class DocumentFragment extends /* #__PURE__ */ EmitterMixin(TypeC
183
183
  * @param type Type of the change.
184
184
  * @param node Changed node.
185
185
  * @param data Additional data.
186
- * @fires module:engine/view/node~Node#event:change
186
+ * @fires module:engine/view/node~ViewNode#event:change
187
187
  */
188
188
  _fireChange(type, node, data) {
189
189
  this.fire(`change:${type}`, node, data);
@@ -191,7 +191,7 @@ export default class DocumentFragment extends /* #__PURE__ */ EmitterMixin(TypeC
191
191
  /**
192
192
  * Sets a custom property. They can be used to add special data to elements.
193
193
  *
194
- * @see module:engine/view/downcastwriter~DowncastWriter#setCustomProperty
194
+ * @see module:engine/view/downcastwriter~ViewDowncastWriter#setCustomProperty
195
195
  * @internal
196
196
  */
197
197
  _setCustomProperty(key, value) {
@@ -200,7 +200,7 @@ export default class DocumentFragment extends /* #__PURE__ */ EmitterMixin(TypeC
200
200
  /**
201
201
  * Removes the custom property stored under the given key.
202
202
  *
203
- * @see module:engine/view/downcastwriter~DowncastWriter#removeCustomProperty
203
+ * @see module:engine/view/downcastwriter~ViewDowncastWriter#removeCustomProperty
204
204
  * @internal
205
205
  * @returns Returns true if property was removed.
206
206
  */
@@ -210,7 +210,7 @@ export default class DocumentFragment extends /* #__PURE__ */ EmitterMixin(TypeC
210
210
  }
211
211
  // The magic of type inference using `is` method is centralized in `TypeCheckable` class.
212
212
  // Proper overload would interfere with that.
213
- DocumentFragment.prototype.is = function (type) {
213
+ ViewDocumentFragment.prototype.is = function (type) {
214
214
  return type === 'documentFragment' || type === 'view:documentFragment';
215
215
  };
216
216
  /**
@@ -219,7 +219,7 @@ DocumentFragment.prototype.is = function (type) {
219
219
  function normalize(document, nodes) {
220
220
  // Separate condition because string is iterable.
221
221
  if (typeof nodes == 'string') {
222
- return [new Text(document, nodes)];
222
+ return [new ViewText(document, nodes)];
223
223
  }
224
224
  if (!isIterable(nodes)) {
225
225
  nodes = [nodes];
@@ -228,10 +228,10 @@ function normalize(document, nodes) {
228
228
  return Array.from(nodes)
229
229
  .map(node => {
230
230
  if (typeof node == 'string') {
231
- return new Text(document, node);
231
+ return new ViewText(document, node);
232
232
  }
233
- if (node instanceof TextProxy) {
234
- return new Text(document, node.data);
233
+ if (node instanceof ViewTextProxy) {
234
+ return new ViewText(document, node.data);
235
235
  }
236
236
  return node;
237
237
  });
@@ -5,52 +5,52 @@
5
5
  /**
6
6
  * @module engine/view/documentselection
7
7
  */
8
- import TypeCheckable from './typecheckable.js';
9
- import Selection, { type PlaceOrOffset, type Selectable, type SelectionOptions, type ViewSelectionChangeEvent } from './selection.js';
10
- import type EditableElement from './editableelement.js';
11
- import type Element from './element.js';
12
- import type Node from './node.js';
13
- import type Item from './item.js';
14
- import type { default as Position, PositionOffset } from './position.js';
15
- import type Range from './range.js';
16
- declare const DocumentSelection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof TypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
8
+ import { ViewTypeCheckable } from './typecheckable.js';
9
+ import { ViewSelection, type ViewPlaceOrOffset, type ViewSelectable, type ViewSelectionOptions, type ViewSelectionChangeEvent } from './selection.js';
10
+ import { type ViewEditableElement } from './editableelement.js';
11
+ import { type ViewElement } from './element.js';
12
+ import { type ViewNode } from './node.js';
13
+ import { type ViewItem } from './item.js';
14
+ import type { ViewPosition, ViewPositionOffset } from './position.js';
15
+ import { type ViewRange } from './range.js';
16
+ declare const ViewDocumentSelection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof ViewTypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
17
17
  /**
18
18
  * Class representing the document selection in the view.
19
19
  *
20
- * Its instance is available in {@link module:engine/view/document~Document#selection `Document#selection`}.
20
+ * Its instance is available in {@link module:engine/view/document~ViewDocument#selection `Document#selection`}.
21
21
  *
22
- * It is similar to {@link module:engine/view/selection~Selection} but
22
+ * It is similar to {@link module:engine/view/selection~ViewSelection} but
23
23
  * it has a read-only API and can be modified only by the writer available in
24
- * the {@link module:engine/view/view~View#change `View#change()`} block
25
- * (so via {@link module:engine/view/downcastwriter~DowncastWriter#setSelection `DowncastWriter#setSelection()`}).
24
+ * the {@link module:engine/view/view~EditingView#change `View#change()`} block
25
+ * (so via {@link module:engine/view/downcastwriter~ViewDowncastWriter#setSelection `ViewDowncastWriter#setSelection()`}).
26
26
  */
27
- export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection_base {
27
+ export declare class ViewDocumentSelection extends /* #__PURE__ */ ViewDocumentSelection_base {
28
28
  /**
29
- * Selection is used internally (`DocumentSelection` is a proxy to that selection).
29
+ * Selection is used internally (`ViewDocumentSelection` is a proxy to that selection).
30
30
  */
31
31
  private readonly _selection;
32
32
  /**
33
- * Creates new DocumentSelection instance.
33
+ * Creates new ViewDocumentSelection instance.
34
34
  *
35
35
  * ```ts
36
36
  * // Creates collapsed selection at the position of given item and offset.
37
37
  * const paragraph = writer.createContainerElement( 'paragraph' );
38
- * const selection = new DocumentSelection( paragraph, offset );
38
+ * const selection = new ViewDocumentSelection( paragraph, offset );
39
39
  *
40
- * // Creates a range inside an {@link module:engine/view/element~Element element} which starts before the
40
+ * // Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the
41
41
  * // first child of that element and ends after the last child of that element.
42
- * const selection = new DocumentSelection( paragraph, 'in' );
42
+ * const selection = new ViewDocumentSelection( paragraph, 'in' );
43
43
  *
44
- * // Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends
44
+ * // Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends
45
45
  * // just after the item.
46
- * const selection = new DocumentSelection( paragraph, 'on' );
46
+ * const selection = new ViewDocumentSelection( paragraph, 'on' );
47
47
  * ```
48
48
  *
49
49
  * `Selection`'s constructor allow passing additional options (`backward`, `fake` and `label`) as the last argument.
50
50
  *
51
51
  * ```ts
52
52
  * // Creates backward selection.
53
- * const selection = new DocumentSelection( element, 'in', { backward: true } );
53
+ * const selection = new ViewDocumentSelection( element, 'in', { backward: true } );
54
54
  * ```
55
55
  *
56
56
  * Fake selection does not render as browser native selection over selected elements and is hidden to the user.
@@ -62,43 +62,43 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
62
62
  *
63
63
  * ```ts
64
64
  * // Creates fake selection with label.
65
- * const selection = new DocumentSelection( element, 'in', { fake: true, label: 'foo' } );
65
+ * const selection = new ViewDocumentSelection( element, 'in', { fake: true, label: 'foo' } );
66
66
  * ```
67
67
  *
68
68
  * See also: {@link #constructor:SELECTABLE `constructor( selectable, options )`}.
69
69
  *
70
70
  * @label NODE_OFFSET
71
71
  */
72
- constructor(selectable: Node, placeOrOffset: PlaceOrOffset, options?: SelectionOptions);
72
+ constructor(selectable: ViewNode, placeOrOffset: ViewPlaceOrOffset, options?: ViewSelectionOptions);
73
73
  /**
74
- * Creates new DocumentSelection instance.
74
+ * Creates new ViewDocumentSelection instance.
75
75
  *
76
76
  * ```ts
77
77
  * // Creates empty selection without ranges.
78
- * const selection = new DocumentSelection();
78
+ * const selection = new ViewDocumentSelection();
79
79
  *
80
80
  * // Creates selection at the given range.
81
81
  * const range = writer.createRange( start, end );
82
- * const selection = new DocumentSelection( range );
82
+ * const selection = new ViewDocumentSelection( range );
83
83
  *
84
84
  * // Creates selection at the given ranges
85
85
  * const ranges = [ writer.createRange( start1, end2 ), writer.createRange( start2, end2 ) ];
86
- * const selection = new DocumentSelection( ranges );
86
+ * const selection = new ViewDocumentSelection( ranges );
87
87
  *
88
88
  * // Creates selection from the other selection.
89
89
  * const otherSelection = writer.createSelection();
90
- * const selection = new DocumentSelection( otherSelection );
90
+ * const selection = new ViewDocumentSelection( otherSelection );
91
91
  *
92
92
  * // Creates selection at the given position.
93
93
  * const position = writer.createPositionAt( root, offset );
94
- * const selection = new DocumentSelection( position );
94
+ * const selection = new ViewDocumentSelection( position );
95
95
  * ```
96
96
  *
97
97
  * `Selection`'s constructor allow passing additional options (`backward`, `fake` and `label`) as the last argument.
98
98
  *
99
99
  * ```ts
100
100
  * // Creates backward selection.
101
- * const selection = new DocumentSelection( range, { backward: true } );
101
+ * const selection = new ViewDocumentSelection( range, { backward: true } );
102
102
  * ```
103
103
  *
104
104
  * Fake selection does not render as browser native selection over selected elements and is hidden to the user.
@@ -110,14 +110,14 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
110
110
  *
111
111
  * ```ts
112
112
  * // Creates fake selection with label.
113
- * const selection = new DocumentSelection( range, { fake: true, label: 'foo' } );
113
+ * const selection = new ViewDocumentSelection( range, { fake: true, label: 'foo' } );
114
114
  * ```
115
115
  *
116
116
  * See also: {@link #constructor:NODE_OFFSET `constructor( node, placeOrOffset, options )`}.
117
117
  *
118
118
  * @label SELECTABLE
119
119
  */
120
- constructor(selectable?: Exclude<Selectable, Node>, options?: SelectionOptions);
120
+ constructor(selectable?: Exclude<ViewSelectable, ViewNode>, options?: ViewSelectionOptions);
121
121
  /**
122
122
  * Returns true if selection instance is marked as `fake`.
123
123
  *
@@ -138,13 +138,13 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
138
138
  *
139
139
  * @see #focus
140
140
  */
141
- get anchor(): Position | null;
141
+ get anchor(): ViewPosition | null;
142
142
  /**
143
143
  * Selection focus. Focus is a position where the selection ends.
144
144
  *
145
145
  * @see #anchor
146
146
  */
147
- get focus(): Position | null;
147
+ get focus(): ViewPosition | null;
148
148
  /**
149
149
  * Returns whether the selection is collapsed. Selection is collapsed when there is exactly one range which is
150
150
  * collapsed.
@@ -159,51 +159,52 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
159
159
  */
160
160
  get isBackward(): boolean;
161
161
  /**
162
- * {@link module:engine/view/editableelement~EditableElement EditableElement} instance that contains this selection, or `null`
162
+ * {@link module:engine/view/editableelement~ViewEditableElement ViewEditableElement} instance that contains this selection, or `null`
163
163
  * if the selection is not inside an editable element.
164
164
  */
165
- get editableElement(): EditableElement | null;
165
+ get editableElement(): ViewEditableElement | null;
166
166
  /**
167
- * Used for the compatibility with the {@link module:engine/view/selection~Selection#isEqual} method.
167
+ * Used for the compatibility with the {@link module:engine/view/selection~ViewSelection#isEqual} method.
168
168
  *
169
169
  * @internal
170
170
  */
171
- get _ranges(): Array<Range>;
171
+ get _ranges(): Array<ViewRange>;
172
172
  /**
173
173
  * Returns an iterable that contains copies of all ranges added to the selection.
174
174
  */
175
- getRanges(): IterableIterator<Range>;
175
+ getRanges(): IterableIterator<ViewRange>;
176
176
  /**
177
177
  * Returns copy of the first range in the selection. First range is the one which
178
- * {@link module:engine/view/range~Range#start start} position {@link module:engine/view/position~Position#isBefore is before} start
178
+ * {@link module:engine/view/range~ViewRange#start start} position
179
+ * {@link module:engine/view/position~ViewPosition#isBefore is before} start
179
180
  * position of all other ranges (not to confuse with the first range added to the selection).
180
181
  * Returns `null` if no ranges are added to selection.
181
182
  */
182
- getFirstRange(): Range | null;
183
+ getFirstRange(): ViewRange | null;
183
184
  /**
184
- * Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~Range#end end}
185
- * position {@link module:engine/view/position~Position#isAfter is after} end position of all other ranges (not to confuse
185
+ * Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~ViewRange#end end}
186
+ * position {@link module:engine/view/position~ViewPosition#isAfter is after} end position of all other ranges (not to confuse
186
187
  * with the last range added to the selection). Returns `null` if no ranges are added to selection.
187
188
  */
188
- getLastRange(): Range | null;
189
+ getLastRange(): ViewRange | null;
189
190
  /**
190
191
  * Returns copy of the first position in the selection. First position is the position that
191
- * {@link module:engine/view/position~Position#isBefore is before} any other position in the selection ranges.
192
+ * {@link module:engine/view/position~ViewPosition#isBefore is before} any other position in the selection ranges.
192
193
  * Returns `null` if no ranges are added to selection.
193
194
  */
194
- getFirstPosition(): Position | null;
195
+ getFirstPosition(): ViewPosition | null;
195
196
  /**
196
197
  * Returns copy of the last position in the selection. Last position is the position that
197
- * {@link module:engine/view/position~Position#isAfter is after} any other position in the selection ranges.
198
+ * {@link module:engine/view/position~ViewPosition#isAfter is after} any other position in the selection ranges.
198
199
  * Returns `null` if no ranges are added to selection.
199
200
  */
200
- getLastPosition(): Position | null;
201
+ getLastPosition(): ViewPosition | null;
201
202
  /**
202
- * Returns the selected element. {@link module:engine/view/element~Element Element} is considered as selected if there is only
203
+ * Returns the selected element. {@link module:engine/view/element~ViewElement Element} is considered as selected if there is only
203
204
  * one range in the selection, and that range contains exactly one element.
204
205
  * Returns `null` if there is no selected element.
205
206
  */
206
- getSelectedElement(): Element | null;
207
+ getSelectedElement(): ViewElement | null;
207
208
  /**
208
209
  * Checks whether, this selection is equal to given selection. Selections are equal if they have same directions,
209
210
  * same number of ranges and all ranges from one selection equal to a range from other selection.
@@ -211,19 +212,19 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
211
212
  * @param otherSelection Selection to compare with.
212
213
  * @returns `true` if selections are equal, `false` otherwise.
213
214
  */
214
- isEqual(otherSelection: Selection | DocumentSelection): boolean;
215
+ isEqual(otherSelection: ViewSelection | ViewDocumentSelection): boolean;
215
216
  /**
216
217
  * Checks whether this selection is similar to given selection. Selections are similar if they have same directions, same
217
- * number of ranges, and all {@link module:engine/view/range~Range#getTrimmed trimmed} ranges from one selection are
218
+ * number of ranges, and all {@link module:engine/view/range~ViewRange#getTrimmed trimmed} ranges from one selection are
218
219
  * equal to any trimmed range from other selection.
219
220
  *
220
221
  * @param otherSelection Selection to compare with.
221
222
  * @returns `true` if selections are similar, `false` otherwise.
222
223
  */
223
- isSimilar(otherSelection: Selection | DocumentSelection): boolean;
224
+ isSimilar(otherSelection: ViewSelection | ViewDocumentSelection): boolean;
224
225
  /**
225
226
  * Sets this selection's ranges and direction to the specified location based on the given
226
- * {@link module:engine/view/selection~Selectable selectable}.
227
+ * {@link module:engine/view/selection~ViewSelectable selectable}.
227
228
  *
228
229
  * ```ts
229
230
  * // Sets selection to the given range.
@@ -246,14 +247,14 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
246
247
  * documentSelection._setTo( paragraph, offset );
247
248
  * ```
248
249
  *
249
- * Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of
250
+ * Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of
250
251
  * that element and ends after the last child of that element.
251
252
  *
252
253
  * ```ts
253
254
  * documentSelection._setTo( paragraph, 'in' );
254
255
  * ```
255
256
  *
256
- * Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends just after the item.
257
+ * Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends just after the item.
257
258
  *
258
259
  * ```ts
259
260
  * documentSelection._setTo( paragraph, 'on' );
@@ -284,23 +285,24 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
284
285
  * @internal
285
286
  * @fires change
286
287
  */
287
- _setTo(...args: Parameters<Selection['setTo']>): void;
288
+ _setTo(...args: Parameters<ViewSelection['setTo']>): void;
288
289
  /**
289
290
  * Moves {@link #focus} to the specified location.
290
291
  *
291
- * The location can be specified in the same form as {@link module:engine/view/view~View#createPositionAt view.createPositionAt()}
292
+ * The location can be specified in the same form as
293
+ * {@link module:engine/view/view~EditingView#createPositionAt view.createPositionAt()}
292
294
  * parameters.
293
295
  *
294
296
  * @internal
295
297
  * @fires change
296
- * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~Item view item}.
298
+ * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.
297
299
  */
298
- _setFocus(itemOrPosition: Item | Position, offset?: PositionOffset): void;
300
+ _setFocus(itemOrPosition: ViewItem | ViewPosition, offset?: ViewPositionOffset): void;
299
301
  }
300
302
  /**
301
- * Fired whenever selection ranges are changed through {@link ~DocumentSelection Selection API}.
303
+ * Fired whenever selection ranges are changed through {@link ~ViewDocumentSelection Selection API}.
302
304
  *
303
- * @eventName ~DocumentSelection#change
305
+ * @eventName ~ViewDocumentSelection#change
304
306
  */
305
307
  export type ViewDocumentSelectionChangeEvent = ViewSelectionChangeEvent;
306
308
  export {};