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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/dist/index.js +2563 -2257
  2. package/dist/index.js.map +1 -1
  3. package/package.json +3 -3
  4. package/src/controller/datacontroller.d.ts +33 -32
  5. package/src/controller/datacontroller.js +29 -28
  6. package/src/controller/editingcontroller.d.ts +8 -8
  7. package/src/controller/editingcontroller.js +10 -10
  8. package/src/conversion/conversion.d.ts +18 -19
  9. package/src/conversion/conversion.js +4 -4
  10. package/src/conversion/conversionhelpers.d.ts +1 -1
  11. package/src/conversion/conversionhelpers.js +1 -1
  12. package/src/conversion/downcastdispatcher.d.ts +63 -69
  13. package/src/conversion/downcastdispatcher.js +16 -16
  14. package/src/conversion/downcasthelpers.d.ts +94 -83
  15. package/src/conversion/downcasthelpers.js +63 -53
  16. package/src/conversion/mapper.d.ts +27 -27
  17. package/src/conversion/mapper.js +15 -15
  18. package/src/conversion/modelconsumable.d.ts +26 -26
  19. package/src/conversion/modelconsumable.js +23 -23
  20. package/src/conversion/upcastdispatcher.d.ts +33 -32
  21. package/src/conversion/upcastdispatcher.js +19 -19
  22. package/src/conversion/upcasthelpers.d.ts +46 -38
  23. package/src/conversion/upcasthelpers.js +33 -24
  24. package/src/conversion/viewconsumable.d.ts +50 -45
  25. package/src/conversion/viewconsumable.js +32 -27
  26. package/src/dataprocessor/basichtmlwriter.d.ts +4 -2
  27. package/src/dataprocessor/basichtmlwriter.js +3 -1
  28. package/src/dataprocessor/dataprocessor.d.ts +7 -6
  29. package/src/dataprocessor/htmldataprocessor.d.ts +10 -10
  30. package/src/dataprocessor/htmldataprocessor.js +6 -6
  31. package/src/dataprocessor/htmlwriter.d.ts +1 -1
  32. package/src/dataprocessor/xmldataprocessor.d.ts +10 -10
  33. package/src/dataprocessor/xmldataprocessor.js +6 -6
  34. package/src/dev-utils/model.d.ts +25 -26
  35. package/src/dev-utils/model.js +35 -36
  36. package/src/dev-utils/operationreplayer.d.ts +5 -3
  37. package/src/dev-utils/operationreplayer.js +4 -2
  38. package/src/dev-utils/utils.d.ts +8 -0
  39. package/src/dev-utils/utils.js +8 -0
  40. package/src/dev-utils/view.d.ts +66 -63
  41. package/src/dev-utils/view.js +144 -134
  42. package/src/index.d.ts +135 -106
  43. package/src/index.js +120 -71
  44. package/src/legacyerrors.d.ts +5 -0
  45. package/src/legacyerrors.js +17 -0
  46. package/src/model/batch.d.ts +2 -15
  47. package/src/model/batch.js +1 -23
  48. package/src/model/differ.d.ts +54 -31
  49. package/src/model/differ.js +15 -15
  50. package/src/model/document.d.ts +31 -31
  51. package/src/model/document.js +13 -13
  52. package/src/model/documentfragment.d.ts +45 -45
  53. package/src/model/documentfragment.js +40 -40
  54. package/src/model/documentselection.d.ts +92 -92
  55. package/src/model/documentselection.js +71 -70
  56. package/src/model/element.d.ts +31 -31
  57. package/src/model/element.js +29 -29
  58. package/src/model/history.d.ts +3 -3
  59. package/src/model/history.js +2 -2
  60. package/src/model/item.d.ts +4 -5
  61. package/src/model/liveposition.d.ts +31 -31
  62. package/src/model/liveposition.js +18 -18
  63. package/src/model/liverange.d.ts +42 -38
  64. package/src/model/liverange.js +17 -16
  65. package/src/model/markercollection.d.ts +41 -40
  66. package/src/model/markercollection.js +22 -20
  67. package/src/model/model.d.ts +82 -81
  68. package/src/model/model.js +54 -54
  69. package/src/model/node.d.ts +48 -48
  70. package/src/model/node.js +31 -31
  71. package/src/model/nodelist.d.ts +17 -17
  72. package/src/model/nodelist.js +11 -11
  73. package/src/model/operation/attributeoperation.d.ts +10 -10
  74. package/src/model/operation/attributeoperation.js +7 -7
  75. package/src/model/operation/detachoperation.d.ts +11 -9
  76. package/src/model/operation/detachoperation.js +8 -6
  77. package/src/model/operation/insertoperation.d.ts +13 -13
  78. package/src/model/operation/insertoperation.js +15 -15
  79. package/src/model/operation/markeroperation.d.ts +12 -12
  80. package/src/model/operation/markeroperation.js +5 -5
  81. package/src/model/operation/mergeoperation.d.ts +16 -16
  82. package/src/model/operation/mergeoperation.js +18 -18
  83. package/src/model/operation/moveoperation.d.ts +16 -16
  84. package/src/model/operation/moveoperation.js +18 -15
  85. package/src/model/operation/nooperation.d.ts +4 -4
  86. package/src/model/operation/nooperation.js +2 -2
  87. package/src/model/operation/operation.d.ts +10 -10
  88. package/src/model/operation/operation.js +5 -5
  89. package/src/model/operation/operationfactory.d.ts +4 -4
  90. package/src/model/operation/operationfactory.js +12 -12
  91. package/src/model/operation/renameoperation.d.ts +10 -10
  92. package/src/model/operation/renameoperation.js +7 -7
  93. package/src/model/operation/rootattributeoperation.d.ts +12 -12
  94. package/src/model/operation/rootattributeoperation.js +8 -8
  95. package/src/model/operation/rootoperation.d.ts +8 -8
  96. package/src/model/operation/rootoperation.js +3 -3
  97. package/src/model/operation/splitoperation.d.ts +17 -17
  98. package/src/model/operation/splitoperation.js +19 -19
  99. package/src/model/operation/transform.d.ts +11 -8
  100. package/src/model/operation/transform.js +66 -49
  101. package/src/model/operation/utils.d.ts +24 -23
  102. package/src/model/operation/utils.js +20 -20
  103. package/src/model/position.d.ts +101 -97
  104. package/src/model/position.js +69 -64
  105. package/src/model/range.d.ts +90 -90
  106. package/src/model/range.js +87 -87
  107. package/src/model/rootelement.d.ts +11 -11
  108. package/src/model/rootelement.js +9 -9
  109. package/src/model/schema.d.ts +158 -154
  110. package/src/model/schema.js +93 -90
  111. package/src/model/selection.d.ts +73 -73
  112. package/src/model/selection.js +62 -62
  113. package/src/model/text.d.ts +11 -10
  114. package/src/model/text.js +11 -10
  115. package/src/model/textproxy.d.ts +39 -38
  116. package/src/model/textproxy.js +31 -30
  117. package/src/model/treewalker.d.ts +37 -37
  118. package/src/model/treewalker.js +14 -14
  119. package/src/model/typecheckable.d.ts +45 -45
  120. package/src/model/typecheckable.js +1 -1
  121. package/src/model/utils/autoparagraphing.d.ts +7 -7
  122. package/src/model/utils/deletecontent.d.ts +7 -5
  123. package/src/model/utils/deletecontent.js +13 -11
  124. package/src/model/utils/getselectedcontent.d.ts +6 -5
  125. package/src/model/utils/getselectedcontent.js +2 -1
  126. package/src/model/utils/insertcontent.d.ts +9 -8
  127. package/src/model/utils/insertcontent.js +41 -40
  128. package/src/model/utils/insertobject.d.ts +9 -9
  129. package/src/model/utils/insertobject.js +4 -4
  130. package/src/model/utils/modifyselection.d.ts +5 -4
  131. package/src/model/utils/modifyselection.js +12 -11
  132. package/src/model/utils/selection-post-fixer.d.ts +12 -8
  133. package/src/model/utils/selection-post-fixer.js +15 -11
  134. package/src/model/writer.d.ts +102 -101
  135. package/src/model/writer.js +99 -98
  136. package/src/view/attributeelement.d.ts +29 -29
  137. package/src/view/attributeelement.js +25 -25
  138. package/src/view/containerelement.d.ts +16 -15
  139. package/src/view/containerelement.js +15 -14
  140. package/src/view/datatransfer.d.ts +7 -7
  141. package/src/view/datatransfer.js +1 -1
  142. package/src/view/document.d.ts +25 -25
  143. package/src/view/document.js +15 -15
  144. package/src/view/documentfragment.d.ts +21 -21
  145. package/src/view/documentfragment.js +14 -14
  146. package/src/view/documentselection.d.ts +65 -63
  147. package/src/view/documentselection.js +27 -25
  148. package/src/view/domconverter.d.ts +94 -89
  149. package/src/view/domconverter.js +78 -73
  150. package/src/view/downcastwriter.d.ts +185 -181
  151. package/src/view/downcastwriter.js +222 -210
  152. package/src/view/editableelement.d.ts +13 -13
  153. package/src/view/editableelement.js +8 -8
  154. package/src/view/element.d.ts +75 -74
  155. package/src/view/element.js +58 -58
  156. package/src/view/elementdefinition.d.ts +3 -4
  157. package/src/view/emptyelement.d.ts +13 -13
  158. package/src/view/emptyelement.js +13 -13
  159. package/src/view/filler.d.ts +14 -3
  160. package/src/view/filler.js +12 -1
  161. package/src/view/item.d.ts +4 -5
  162. package/src/view/matcher.d.ts +22 -19
  163. package/src/view/matcher.js +6 -6
  164. package/src/view/node.d.ts +33 -33
  165. package/src/view/node.js +9 -9
  166. package/src/view/observer/arrowkeysobserver.d.ts +10 -10
  167. package/src/view/observer/arrowkeysobserver.js +5 -5
  168. package/src/view/observer/bubblingemittermixin.d.ts +5 -5
  169. package/src/view/observer/bubblingemittermixin.js +2 -9
  170. package/src/view/observer/bubblingeventinfo.d.ts +9 -9
  171. package/src/view/observer/bubblingeventinfo.js +1 -1
  172. package/src/view/observer/clickobserver.d.ts +8 -8
  173. package/src/view/observer/clickobserver.js +4 -4
  174. package/src/view/observer/compositionobserver.d.ts +19 -19
  175. package/src/view/observer/compositionobserver.js +6 -6
  176. package/src/view/observer/domeventdata.d.ts +9 -9
  177. package/src/view/observer/domeventdata.js +2 -2
  178. package/src/view/observer/domeventobserver.d.ts +3 -3
  179. package/src/view/observer/domeventobserver.js +5 -5
  180. package/src/view/observer/fakeselectionobserver.d.ts +9 -9
  181. package/src/view/observer/fakeselectionobserver.js +8 -8
  182. package/src/view/observer/focusobserver.d.ts +16 -16
  183. package/src/view/observer/focusobserver.js +7 -7
  184. package/src/view/observer/inputobserver.d.ts +18 -18
  185. package/src/view/observer/inputobserver.js +5 -5
  186. package/src/view/observer/keyobserver.d.ts +11 -11
  187. package/src/view/observer/keyobserver.js +3 -3
  188. package/src/view/observer/mouseobserver.d.ts +16 -16
  189. package/src/view/observer/mouseobserver.js +3 -3
  190. package/src/view/observer/mutationobserver.d.ts +21 -21
  191. package/src/view/observer/mutationobserver.js +7 -7
  192. package/src/view/observer/observer.d.ts +12 -12
  193. package/src/view/observer/observer.js +6 -6
  194. package/src/view/observer/selectionobserver.d.ts +33 -33
  195. package/src/view/observer/selectionobserver.js +14 -14
  196. package/src/view/observer/tabobserver.d.ts +10 -10
  197. package/src/view/observer/tabobserver.js +5 -5
  198. package/src/view/observer/touchobserver.d.ts +13 -13
  199. package/src/view/observer/touchobserver.js +3 -3
  200. package/src/view/placeholder.d.ts +21 -21
  201. package/src/view/placeholder.js +23 -23
  202. package/src/view/position.d.ts +49 -49
  203. package/src/view/position.js +42 -42
  204. package/src/view/range.d.ts +76 -74
  205. package/src/view/range.js +67 -65
  206. package/src/view/rawelement.d.ts +19 -19
  207. package/src/view/rawelement.js +16 -16
  208. package/src/view/renderer.d.ts +14 -14
  209. package/src/view/renderer.js +7 -7
  210. package/src/view/rooteditableelement.d.ts +8 -7
  211. package/src/view/rooteditableelement.js +7 -6
  212. package/src/view/selection.d.ts +66 -64
  213. package/src/view/selection.js +50 -48
  214. package/src/view/styles/background.d.ts +2 -2
  215. package/src/view/styles/background.js +9 -9
  216. package/src/view/styles/border.d.ts +2 -2
  217. package/src/view/styles/border.js +13 -13
  218. package/src/view/styles/margin.d.ts +2 -2
  219. package/src/view/styles/margin.js +5 -5
  220. package/src/view/styles/padding.d.ts +2 -2
  221. package/src/view/styles/padding.js +5 -5
  222. package/src/view/styles/utils.d.ts +24 -24
  223. package/src/view/styles/utils.js +25 -25
  224. package/src/view/stylesmap.d.ts +28 -32
  225. package/src/view/stylesmap.js +52 -39
  226. package/src/view/text.d.ts +11 -11
  227. package/src/view/text.js +10 -10
  228. package/src/view/textproxy.d.ts +33 -32
  229. package/src/view/textproxy.js +23 -22
  230. package/src/view/tokenlist.d.ts +14 -14
  231. package/src/view/tokenlist.js +10 -10
  232. package/src/view/treewalker.d.ts +42 -40
  233. package/src/view/treewalker.js +36 -35
  234. package/src/view/typecheckable.d.ts +76 -75
  235. package/src/view/typecheckable.js +1 -1
  236. package/src/view/uielement.d.ts +22 -21
  237. package/src/view/uielement.js +17 -16
  238. package/src/view/upcastwriter.d.ts +70 -70
  239. package/src/view/upcastwriter.js +42 -42
  240. package/src/view/view.d.ts +70 -69
  241. package/src/view/view.js +56 -55
@@ -5,12 +5,12 @@
5
5
  /**
6
6
  * @module engine/view/uielement
7
7
  */
8
- import Element, { type ElementAttributes } from './element.js';
9
- import Node from './node.js';
10
- import type View from './view.js';
11
- import type Document from './document.js';
12
- import type DomConverter from './domconverter.js';
13
- import type Item from './item.js';
8
+ import { ViewElement, type ViewElementAttributes } from './element.js';
9
+ import { ViewNode } from './node.js';
10
+ import { type EditingView } from './view.js';
11
+ import { type ViewDocument } from './document.js';
12
+ import { type ViewDomConverter } from './domconverter.js';
13
+ import { type ViewItem } from './item.js';
14
14
  type DomDocument = globalThis.Document;
15
15
  type DomElement = globalThis.HTMLElement;
16
16
  /**
@@ -19,44 +19,44 @@ type DomElement = globalThis.HTMLElement;
19
19
  * UI elements can be used.
20
20
  *
21
21
  * How a UI element is rendered is in your control (you pass a callback to
22
- * {@link module:engine/view/downcastwriter~DowncastWriter#createUIElement `downcastWriter#createUIElement()`}).
22
+ * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `downcastWriter#createUIElement()`}).
23
23
  * The editor will ignore your UI element – the selection cannot be placed in it, it is skipped (invisible) when
24
24
  * the user modifies the selection by using arrow keys and the editor does not listen to any mutations which
25
25
  * happen inside your UI elements.
26
26
  *
27
27
  * The limitation is that you cannot convert a model element to a UI element. UI elements need to be
28
28
  * created for {@link module:engine/model/markercollection~Marker markers} or as additinal elements
29
- * inside normal {@link module:engine/view/containerelement~ContainerElement container elements}.
29
+ * inside normal {@link module:engine/view/containerelement~ViewContainerElement container elements}.
30
30
  *
31
31
  * To create a new UI element use the
32
- * {@link module:engine/view/downcastwriter~DowncastWriter#createUIElement `downcastWriter#createUIElement()`} method.
32
+ * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `downcastWriter#createUIElement()`} method.
33
33
  */
34
- export default class UIElement extends Element {
34
+ export declare class ViewUIElement extends ViewElement {
35
35
  /**
36
36
  * Creates new instance of UIElement.
37
37
  *
38
38
  * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` when third parameter is passed,
39
39
  * to inform that usage of UIElement is incorrect (adding child nodes to UIElement is forbidden).
40
40
  *
41
- * @see module:engine/view/downcastwriter~DowncastWriter#createUIElement
41
+ * @see module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement
42
42
  * @internal
43
43
  * @param document The document instance to which this element belongs.
44
44
  * @param name Node name.
45
45
  * @param attrs Collection of attributes.
46
46
  * @param children A list of nodes to be inserted into created element.
47
47
  */
48
- constructor(document: Document, name: string, attrs?: ElementAttributes, children?: Node | Iterable<Node>);
48
+ constructor(document: ViewDocument, name: string, attrs?: ViewElementAttributes, children?: ViewNode | Iterable<ViewNode>);
49
49
  /**
50
- * Overrides {@link module:engine/view/element~Element#_insertChild} method.
50
+ * Overrides {@link module:engine/view/element~ViewElement#_insertChild} method.
51
51
  * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` to prevent adding any child nodes
52
52
  * to UIElement.
53
53
  *
54
54
  * @internal
55
55
  */
56
- _insertChild(index: number, items: Item | Iterable<Item>): number;
56
+ _insertChild(index: number, items: ViewItem | Iterable<ViewItem>): number;
57
57
  /**
58
- * Renders this {@link module:engine/view/uielement~UIElement} to DOM. This method is called by
59
- * {@link module:engine/view/domconverter~DomConverter}.
58
+ * Renders this {@link module:engine/view/uielement~ViewUIElement} to DOM. This method is called by
59
+ * {@link module:engine/view/domconverter~ViewDomConverter}.
60
60
  * Do not use inheritance to create custom rendering method, replace `render()` method instead:
61
61
  *
62
62
  * ```ts
@@ -74,9 +74,9 @@ export default class UIElement extends Element {
74
74
  * the {@link module:ui/editorui/editorui~EditorUI#update `editor.ui.update()`} method
75
75
  * after rendering your UI element.
76
76
  *
77
- * @param domConverter Instance of the DomConverter used to optimize the output.
77
+ * @param domConverter Instance of the ViewDomConverter used to optimize the output.
78
78
  */
79
- render(domDocument: DomDocument, domConverter: DomConverter): DomElement;
79
+ render(domDocument: DomDocument, domConverter: ViewDomConverter): DomElement;
80
80
  /**
81
81
  * Creates DOM element based on this view UIElement.
82
82
  * Note that each time this method is called new DOM element is created.
@@ -84,13 +84,14 @@ export default class UIElement extends Element {
84
84
  toDomElement(domDocument: DomDocument): DomElement;
85
85
  }
86
86
  /**
87
- * This function injects UI element handling to the given {@link module:engine/view/document~Document document}.
87
+ * This function injects UI element handling to the given {@link module:engine/view/document~ViewDocument document}.
88
88
  *
89
- * A callback is added to {@link module:engine/view/document~Document#event:keydown document keydown event}.
89
+ * A callback is added to {@link module:engine/view/document~ViewDocument#event:keydown document keydown event}.
90
90
  * The callback handles the situation when right arrow key is pressed and selection is collapsed before a UI element.
91
91
  * Without this handler, it would be impossible to "jump over" UI element using right arrow key.
92
92
  *
93
93
  * @param view View controller to which the quirks handling will be injected.
94
+ * @internal
94
95
  */
95
- export declare function injectUiElementHandling(view: View): void;
96
+ export declare function injectUiElementHandling(view: EditingView): void;
96
97
  export {};
@@ -5,8 +5,8 @@
5
5
  /**
6
6
  * @module engine/view/uielement
7
7
  */
8
- import Element from './element.js';
9
- import Node from './node.js';
8
+ import { ViewElement } from './element.js';
9
+ import { ViewNode } from './node.js';
10
10
  import { CKEditorError, keyCodes } from '@ckeditor/ckeditor5-utils';
11
11
  /**
12
12
  * UI element class. It should be used to represent editing UI which needs to be injected into the editing view
@@ -14,26 +14,26 @@ import { CKEditorError, keyCodes } from '@ckeditor/ckeditor5-utils';
14
14
  * UI elements can be used.
15
15
  *
16
16
  * How a UI element is rendered is in your control (you pass a callback to
17
- * {@link module:engine/view/downcastwriter~DowncastWriter#createUIElement `downcastWriter#createUIElement()`}).
17
+ * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `downcastWriter#createUIElement()`}).
18
18
  * The editor will ignore your UI element – the selection cannot be placed in it, it is skipped (invisible) when
19
19
  * the user modifies the selection by using arrow keys and the editor does not listen to any mutations which
20
20
  * happen inside your UI elements.
21
21
  *
22
22
  * The limitation is that you cannot convert a model element to a UI element. UI elements need to be
23
23
  * created for {@link module:engine/model/markercollection~Marker markers} or as additinal elements
24
- * inside normal {@link module:engine/view/containerelement~ContainerElement container elements}.
24
+ * inside normal {@link module:engine/view/containerelement~ViewContainerElement container elements}.
25
25
  *
26
26
  * To create a new UI element use the
27
- * {@link module:engine/view/downcastwriter~DowncastWriter#createUIElement `downcastWriter#createUIElement()`} method.
27
+ * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `downcastWriter#createUIElement()`} method.
28
28
  */
29
- export default class UIElement extends Element {
29
+ export class ViewUIElement extends ViewElement {
30
30
  /**
31
31
  * Creates new instance of UIElement.
32
32
  *
33
33
  * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` when third parameter is passed,
34
34
  * to inform that usage of UIElement is incorrect (adding child nodes to UIElement is forbidden).
35
35
  *
36
- * @see module:engine/view/downcastwriter~DowncastWriter#createUIElement
36
+ * @see module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement
37
37
  * @internal
38
38
  * @param document The document instance to which this element belongs.
39
39
  * @param name Node name.
@@ -45,16 +45,16 @@ export default class UIElement extends Element {
45
45
  this.getFillerOffset = getFillerOffset;
46
46
  }
47
47
  /**
48
- * Overrides {@link module:engine/view/element~Element#_insertChild} method.
48
+ * Overrides {@link module:engine/view/element~ViewElement#_insertChild} method.
49
49
  * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` to prevent adding any child nodes
50
50
  * to UIElement.
51
51
  *
52
52
  * @internal
53
53
  */
54
54
  _insertChild(index, items) {
55
- if (items && (items instanceof Node || Array.from(items).length > 0)) {
55
+ if (items && (items instanceof ViewNode || Array.from(items).length > 0)) {
56
56
  /**
57
- * Cannot add children to {@link module:engine/view/uielement~UIElement}.
57
+ * Cannot add children to {@link module:engine/view/uielement~ViewUIElement}.
58
58
  *
59
59
  * @error view-uielement-cannot-add
60
60
  */
@@ -63,8 +63,8 @@ export default class UIElement extends Element {
63
63
  return 0;
64
64
  }
65
65
  /**
66
- * Renders this {@link module:engine/view/uielement~UIElement} to DOM. This method is called by
67
- * {@link module:engine/view/domconverter~DomConverter}.
66
+ * Renders this {@link module:engine/view/uielement~ViewUIElement} to DOM. This method is called by
67
+ * {@link module:engine/view/domconverter~ViewDomConverter}.
68
68
  * Do not use inheritance to create custom rendering method, replace `render()` method instead:
69
69
  *
70
70
  * ```ts
@@ -82,7 +82,7 @@ export default class UIElement extends Element {
82
82
  * the {@link module:ui/editorui/editorui~EditorUI#update `editor.ui.update()`} method
83
83
  * after rendering your UI element.
84
84
  *
85
- * @param domConverter Instance of the DomConverter used to optimize the output.
85
+ * @param domConverter Instance of the ViewDomConverter used to optimize the output.
86
86
  */
87
87
  render(domDocument, domConverter // eslint-disable-line @typescript-eslint/no-unused-vars
88
88
  ) {
@@ -103,7 +103,7 @@ export default class UIElement extends Element {
103
103
  }
104
104
  // The magic of type inference using `is` method is centralized in `TypeCheckable` class.
105
105
  // Proper overload would interfere with that.
106
- UIElement.prototype.is = function (type, name) {
106
+ ViewUIElement.prototype.is = function (type, name) {
107
107
  if (!name) {
108
108
  return type === 'uiElement' || type === 'view:uiElement' ||
109
109
  // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
@@ -116,13 +116,14 @@ UIElement.prototype.is = function (type, name) {
116
116
  }
117
117
  };
118
118
  /**
119
- * This function injects UI element handling to the given {@link module:engine/view/document~Document document}.
119
+ * This function injects UI element handling to the given {@link module:engine/view/document~ViewDocument document}.
120
120
  *
121
- * A callback is added to {@link module:engine/view/document~Document#event:keydown document keydown event}.
121
+ * A callback is added to {@link module:engine/view/document~ViewDocument#event:keydown document keydown event}.
122
122
  * The callback handles the situation when right arrow key is pressed and selection is collapsed before a UI element.
123
123
  * Without this handler, it would be impossible to "jump over" UI element using right arrow key.
124
124
  *
125
125
  * @param view View controller to which the quirks handling will be injected.
126
+ * @internal
126
127
  */
127
128
  export function injectUiElementHandling(view) {
128
129
  view.document.on('arrowKey', (evt, data) => jumpOverUiElement(evt, data, view.domConverter), { priority: 'low' });
@@ -5,54 +5,54 @@
5
5
  /**
6
6
  * @module engine/view/upcastwriter
7
7
  */
8
- import DocumentFragment from './documentfragment.js';
9
- import Element, { type ElementAttributes } from './element.js';
10
- import Text from './text.js';
11
- import Position, { type PositionOffset } from './position.js';
12
- import Range from './range.js';
13
- import Selection, { type PlaceOrOffset, type Selectable, type SelectionOptions } from './selection.js';
14
- import type Document from './document.js';
15
- import type Item from './item.js';
16
- import type Node from './node.js';
8
+ import { ViewDocumentFragment } from './documentfragment.js';
9
+ import { ViewElement, type ViewElementAttributes } from './element.js';
10
+ import { ViewText } from './text.js';
11
+ import { ViewPosition, type ViewPositionOffset } from './position.js';
12
+ import { ViewRange } from './range.js';
13
+ import { ViewSelection, type ViewPlaceOrOffset, type ViewSelectable, type ViewSelectionOptions } from './selection.js';
14
+ import { type ViewDocument } from './document.js';
15
+ import { type ViewItem } from './item.js';
16
+ import { type ViewNode } from './node.js';
17
17
  /**
18
18
  * View upcast writer. It provides a set of methods used to manipulate non-semantic view trees.
19
19
  *
20
20
  * It should be used only while working on a non-semantic view
21
21
  * (e.g. a view created from HTML string on paste).
22
22
  * To manipulate a view which was or is being downcasted from the the model use the
23
- * {@link module:engine/view/downcastwriter~DowncastWriter downcast writer}.
23
+ * {@link module:engine/view/downcastwriter~ViewDowncastWriter downcast writer}.
24
24
  *
25
25
  * Read more about changing the view in the {@glink framework/architecture/editing-engine#changing-the-view Changing the view}
26
26
  * section of the {@glink framework/architecture/editing-engine Editing engine architecture} guide.
27
27
  *
28
- * Unlike `DowncastWriter`, which is available in the {@link module:engine/view/view~View#change `View#change()`} block,
29
- * `UpcastWriter` can be created wherever you need it:
28
+ * Unlike `ViewDowncastWriter`, which is available in the {@link module:engine/view/view~EditingView#change `View#change()`} block,
29
+ * `ViewUpcastWriter` can be created wherever you need it:
30
30
  *
31
31
  * ```ts
32
- * const writer = new UpcastWriter( viewDocument );
32
+ * const writer = new ViewUpcastWriter( viewDocument );
33
33
  * const text = writer.createText( 'foo!' );
34
34
  *
35
35
  * writer.appendChild( text, someViewElement );
36
36
  * ```
37
37
  */
38
- export default class UpcastWriter {
38
+ export declare class ViewUpcastWriter {
39
39
  /**
40
40
  * The view document instance in which this upcast writer operates.
41
41
  */
42
- readonly document: Document;
42
+ readonly document: ViewDocument;
43
43
  /**
44
44
  * @param document The view document instance in which this upcast writer operates.
45
45
  */
46
- constructor(document: Document);
46
+ constructor(document: ViewDocument);
47
47
  /**
48
- * Creates a new {@link module:engine/view/documentfragment~DocumentFragment} instance.
48
+ * Creates a new {@link module:engine/view/documentfragment~ViewDocumentFragment} instance.
49
49
  *
50
50
  * @param children A list of nodes to be inserted into the created document fragment.
51
51
  * @returns The created document fragment.
52
52
  */
53
- createDocumentFragment(children?: Node | Iterable<Node>): DocumentFragment;
53
+ createDocumentFragment(children?: ViewNode | Iterable<ViewNode>): ViewDocumentFragment;
54
54
  /**
55
- * Creates a new {@link module:engine/view/element~Element} instance.
55
+ * Creates a new {@link module:engine/view/element~ViewElement} instance.
56
56
  *
57
57
  * Attributes can be passed in various formats:
58
58
  *
@@ -67,62 +67,62 @@ export default class UpcastWriter {
67
67
  * @param children A list of nodes to be inserted into created element.
68
68
  * @returns Created element.
69
69
  */
70
- createElement(name: string, attrs?: ElementAttributes, children?: Node | Iterable<Node>): Element;
70
+ createElement(name: string, attrs?: ViewElementAttributes, children?: ViewNode | Iterable<ViewNode>): ViewElement;
71
71
  /**
72
- * Creates a new {@link module:engine/view/text~Text} instance.
72
+ * Creates a new {@link module:engine/view/text~ViewText} instance.
73
73
  *
74
74
  * @param data The text's data.
75
75
  * @returns The created text node.
76
76
  */
77
- createText(data: string): Text;
77
+ createText(data: string): ViewText;
78
78
  /**
79
79
  * Clones the provided element.
80
80
  *
81
- * @see module:engine/view/element~Element#_clone
81
+ * @see module:engine/view/element~ViewElement#_clone
82
82
  * @param element Element to be cloned.
83
83
  * @param deep If set to `true` clones element and all its children recursively. When set to `false`,
84
84
  * element will be cloned without any children.
85
85
  * @returns Clone of this element.
86
86
  */
87
- clone(element: Element, deep?: boolean): Element;
87
+ clone(element: ViewElement, deep?: boolean): ViewElement;
88
88
  /**
89
89
  * Appends a child node or a list of child nodes at the end of this node
90
90
  * and sets the parent of these nodes to this element.
91
91
  *
92
- * @see module:engine/view/element~Element#_appendChild
92
+ * @see module:engine/view/element~ViewElement#_appendChild
93
93
  * @param items Items to be inserted.
94
94
  * @param element Element to which items will be appended.
95
95
  * @returns Number of appended nodes.
96
96
  */
97
- appendChild(items: Item | string | Iterable<Item | string>, element: Element | DocumentFragment): number;
97
+ appendChild(items: ViewItem | string | Iterable<ViewItem | string>, element: ViewElement | ViewDocumentFragment): number;
98
98
  /**
99
99
  * Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to
100
100
  * this element.
101
101
  *
102
- * @see module:engine/view/element~Element#_insertChild
102
+ * @see module:engine/view/element~ViewElement#_insertChild
103
103
  * @param index Offset at which nodes should be inserted.
104
104
  * @param items Items to be inserted.
105
105
  * @param element Element to which items will be inserted.
106
106
  * @returns Number of inserted nodes.
107
107
  */
108
- insertChild(index: number, items: Item | Iterable<Item>, element: Element | DocumentFragment): number;
108
+ insertChild(index: number, items: ViewItem | Iterable<ViewItem>, element: ViewElement | ViewDocumentFragment): number;
109
109
  /**
110
110
  * Removes the given number of child nodes starting at the given index and set the parent of these nodes to `null`.
111
111
  *
112
- * @see module:engine/view/element~Element#_removeChildren
112
+ * @see module:engine/view/element~ViewElement#_removeChildren
113
113
  * @param index Offset from which nodes will be removed.
114
114
  * @param howMany Number of nodes to remove.
115
115
  * @param element Element which children will be removed.
116
116
  * @returns The array containing removed nodes.
117
117
  */
118
- removeChildren(index: number, howMany: number, element: Element | DocumentFragment): Array<Node>;
118
+ removeChildren(index: number, howMany: number, element: ViewElement | ViewDocumentFragment): Array<ViewNode>;
119
119
  /**
120
120
  * Removes given element from the view structure. Will not have effect on detached elements.
121
121
  *
122
122
  * @param element Element which will be removed.
123
123
  * @returns The array containing removed nodes.
124
124
  */
125
- remove(element: Node): Array<Node>;
125
+ remove(element: ViewNode): Array<ViewNode>;
126
126
  /**
127
127
  * Replaces given element with the new one in the view structure. Will not have effect on detached elements.
128
128
  *
@@ -130,14 +130,14 @@ export default class UpcastWriter {
130
130
  * @param newElement Element which will be inserted in the place of the old element.
131
131
  * @returns Whether old element was successfully replaced.
132
132
  */
133
- replace(oldElement: Element, newElement: Element): boolean;
133
+ replace(oldElement: ViewElement, newElement: ViewElement): boolean;
134
134
  /**
135
135
  * Removes given element from view structure and places its children in its position.
136
136
  * It does nothing if element has no parent.
137
137
  *
138
138
  * @param element Element to unwrap.
139
139
  */
140
- unwrapElement(element: Element): void;
140
+ unwrapElement(element: ViewElement): void;
141
141
  /**
142
142
  * Renames element by creating a copy of a given element but with its name changed and then moving contents of the
143
143
  * old element to the new one.
@@ -148,7 +148,7 @@ export default class UpcastWriter {
148
148
  * @param element Element to be renamed.
149
149
  * @returns New element or null if the old element was not replaced (happens for detached elements).
150
150
  */
151
- rename(newName: string, element: Element): Element | null;
151
+ rename(newName: string, element: ViewElement): ViewElement | null;
152
152
  /**
153
153
  * Adds or overwrites element's attribute with a specified key and value.
154
154
  *
@@ -156,12 +156,12 @@ export default class UpcastWriter {
156
156
  * writer.setAttribute( 'href', 'http://ckeditor.com', linkElement );
157
157
  * ```
158
158
  *
159
- * @see module:engine/view/element~Element#_setAttribute
159
+ * @see module:engine/view/element~ViewElement#_setAttribute
160
160
  * @param key Attribute key.
161
161
  * @param value Attribute value.
162
162
  * @param element Element for which attribute will be set.
163
163
  */
164
- setAttribute(key: string, value: unknown, element: Element): void;
164
+ setAttribute(key: string, value: unknown, element: ViewElement): void;
165
165
  /**
166
166
  * Removes attribute from the element.
167
167
  *
@@ -169,11 +169,11 @@ export default class UpcastWriter {
169
169
  * writer.removeAttribute( 'href', linkElement );
170
170
  * ```
171
171
  *
172
- * @see module:engine/view/element~Element#_removeAttribute
172
+ * @see module:engine/view/element~ViewElement#_removeAttribute
173
173
  * @param key Attribute key.
174
174
  * @param element Element from which attribute will be removed.
175
175
  */
176
- removeAttribute(key: string, element: Element): void;
176
+ removeAttribute(key: string, element: ViewElement): void;
177
177
  /**
178
178
  * Adds specified class to the element.
179
179
  *
@@ -182,11 +182,11 @@ export default class UpcastWriter {
182
182
  * writer.addClass( [ 'foo', 'bar' ], linkElement );
183
183
  * ```
184
184
  *
185
- * @see module:engine/view/element~Element#_addClass
185
+ * @see module:engine/view/element~ViewElement#_addClass
186
186
  * @param className Single class name or array of class names which will be added.
187
187
  * @param element Element for which class will be added.
188
188
  */
189
- addClass(className: string | Array<string>, element: Element): void;
189
+ addClass(className: string | Array<string>, element: ViewElement): void;
190
190
  /**
191
191
  * Removes specified class from the element.
192
192
  *
@@ -195,11 +195,11 @@ export default class UpcastWriter {
195
195
  * writer.removeClass( [ 'foo', 'bar' ], linkElement );
196
196
  * ```
197
197
  *
198
- * @see module:engine/view/element~Element#_removeClass
198
+ * @see module:engine/view/element~ViewElement#_removeClass
199
199
  * @param className Single class name or array of class names which will be removed.
200
200
  * @param element Element from which class will be removed.
201
201
  */
202
- removeClass(className: string | Array<string>, element: Element): void;
202
+ removeClass(className: string | Array<string>, element: ViewElement): void;
203
203
  /**
204
204
  * Adds style to the element.
205
205
  *
@@ -211,13 +211,13 @@ export default class UpcastWriter {
211
211
  * {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
212
212
  * See {@link module:engine/view/stylesmap~StylesMap#set `StylesMap#set()`} for details.
213
213
  *
214
- * @see module:engine/view/element~Element#_setStyle
214
+ * @see module:engine/view/element~ViewElement#_setStyle
215
215
  * @label KEY_VALUE
216
216
  * @param property Property name.
217
217
  * @param value Value to set.
218
218
  * @param element Element for which style will be added.
219
219
  */
220
- setStyle(property: string, value: string, element: Element): void;
220
+ setStyle(property: string, value: string, element: ViewElement): void;
221
221
  /**
222
222
  * Adds style to the element.
223
223
  *
@@ -232,12 +232,12 @@ export default class UpcastWriter {
232
232
  * {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
233
233
  * See {@link module:engine/view/stylesmap~StylesMap#set `StylesMap#set()`} for details.
234
234
  *
235
- * @see module:engine/view/element~Element#_setStyle
235
+ * @see module:engine/view/element~ViewElement#_setStyle
236
236
  * @label OBJECT
237
237
  * @param properties Object with key - value pairs.
238
238
  * @param element Element for which style will be added.
239
239
  */
240
- setStyle(properties: Record<string, string>, element: Element): void;
240
+ setStyle(properties: Record<string, string>, element: ViewElement): void;
241
241
  /**
242
242
  * Removes specified style from the element.
243
243
  *
@@ -250,91 +250,91 @@ export default class UpcastWriter {
250
250
  * {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
251
251
  * See {@link module:engine/view/stylesmap~StylesMap#remove `StylesMap#remove()`} for details.
252
252
  *
253
- * @see module:engine/view/element~Element#_removeStyle
253
+ * @see module:engine/view/element~ViewElement#_removeStyle
254
254
  * @param property Style property name or names to be removed.
255
255
  * @param element Element from which style will be removed.
256
256
  */
257
- removeStyle(property: string | Array<string>, element: Element): void;
257
+ removeStyle(property: string | Array<string>, element: ViewElement): void;
258
258
  /**
259
259
  * Sets a custom property on element. Unlike attributes, custom properties are not rendered to the DOM,
260
260
  * so they can be used to add special data to elements.
261
261
  *
262
- * @see module:engine/view/element~Element#_setCustomProperty
262
+ * @see module:engine/view/element~ViewElement#_setCustomProperty
263
263
  * @param key Custom property name/key.
264
264
  * @param value Custom property value to be stored.
265
265
  * @param element Element for which custom property will be set.
266
266
  */
267
- setCustomProperty(key: string | symbol, value: unknown, element: Element | DocumentFragment): void;
267
+ setCustomProperty(key: string | symbol, value: unknown, element: ViewElement | ViewDocumentFragment): void;
268
268
  /**
269
269
  * Removes a custom property stored under the given key.
270
270
  *
271
- * @see module:engine/view/element~Element#_removeCustomProperty
271
+ * @see module:engine/view/element~ViewElement#_removeCustomProperty
272
272
  * @param key Name/key of the custom property to be removed.
273
273
  * @param element Element from which the custom property will be removed.
274
274
  * @returns Returns true if property was removed.
275
275
  */
276
- removeCustomProperty(key: string | symbol, element: Element | DocumentFragment): boolean;
276
+ removeCustomProperty(key: string | symbol, element: ViewElement | ViewDocumentFragment): boolean;
277
277
  /**
278
278
  * Creates position at the given location. The location can be specified as:
279
279
  *
280
- * * a {@link module:engine/view/position~Position position},
280
+ * * a {@link module:engine/view/position~ViewPosition position},
281
281
  * * parent element and offset (offset defaults to `0`),
282
282
  * * parent element and `'end'` (sets position at the end of that element),
283
- * * {@link module:engine/view/item~Item view item} and `'before'` or `'after'` (sets position before or after given view item).
283
+ * * {@link module:engine/view/item~ViewItem view item} and `'before'` or `'after'` (sets position before or after given view item).
284
284
  *
285
285
  * This method is a shortcut to other constructors such as:
286
286
  *
287
287
  * * {@link #createPositionBefore},
288
288
  * * {@link #createPositionAfter},
289
289
  *
290
- * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~Item view item}.
290
+ * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.
291
291
  */
292
- createPositionAt(itemOrPosition: Item | Position, offset?: PositionOffset): Position;
292
+ createPositionAt(itemOrPosition: ViewItem | ViewPosition, offset?: ViewPositionOffset): ViewPosition;
293
293
  /**
294
294
  * Creates a new position after given view item.
295
295
  *
296
296
  * @param item View item after which the position should be located.
297
297
  */
298
- createPositionAfter(item: Item): Position;
298
+ createPositionAfter(item: ViewItem): ViewPosition;
299
299
  /**
300
300
  * Creates a new position before given view item.
301
301
  *
302
302
  * @param item View item before which the position should be located.
303
303
  */
304
- createPositionBefore(item: Item): Position;
304
+ createPositionBefore(item: ViewItem): ViewPosition;
305
305
  /**
306
306
  * Creates a range spanning from `start` position to `end` position.
307
307
  *
308
- * **Note:** This factory method creates it's own {@link module:engine/view/position~Position} instances basing on passed values.
308
+ * **Note:** This factory method creates it's own {@link module:engine/view/position~ViewPosition} instances basing on passed values.
309
309
  *
310
310
  * @param start Start position.
311
311
  * @param end End position. If not set, range will be collapsed at `start` position.
312
312
  */
313
- createRange(start: Position, end: Position): Range;
313
+ createRange(start: ViewPosition, end: ViewPosition): ViewRange;
314
314
  /**
315
- * Creates a range that starts before given {@link module:engine/view/item~Item view item} and ends after it.
315
+ * Creates a range that starts before given {@link module:engine/view/item~ViewItem view item} and ends after it.
316
316
  */
317
- createRangeOn(item: Item): Range;
317
+ createRangeOn(item: ViewItem): ViewRange;
318
318
  /**
319
- * Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of
319
+ * Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of
320
320
  * that element and ends after the last child of that element.
321
321
  *
322
322
  * @param element Element which is a parent for the range.
323
323
  */
324
- createRangeIn(element: Element | DocumentFragment): Range;
324
+ createRangeIn(element: ViewElement | ViewDocumentFragment): ViewRange;
325
325
  /**
326
- * Creates a new {@link module:engine/view/selection~Selection} instance.
326
+ * Creates a new {@link module:engine/view/selection~ViewSelection} instance.
327
327
  *
328
328
  * ```ts
329
329
  * // Creates collapsed selection at the position of given item and offset.
330
330
  * const paragraph = writer.createContainerElement( 'paragraph' );
331
331
  * const selection = writer.createSelection( paragraph, offset );
332
332
  *
333
- * // Creates a range inside an {@link module:engine/view/element~Element element} which starts before the
333
+ * // Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the
334
334
  * // first child of that element and ends after the last child of that element.
335
335
  * const selection = writer.createSelection( paragraph, 'in' );
336
336
  *
337
- * // Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends
337
+ * // Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends
338
338
  * // just after the item.
339
339
  * const selection = writer.createSelection( paragraph, 'on' );
340
340
  * ```
@@ -362,9 +362,9 @@ export default class UpcastWriter {
362
362
  *
363
363
  * @label NODE_OFFSET
364
364
  */
365
- createSelection(selectable: Node, placeOrOffset: PlaceOrOffset, options?: SelectionOptions): Selection;
365
+ createSelection(selectable: ViewNode, placeOrOffset: ViewPlaceOrOffset, options?: ViewSelectionOptions): ViewSelection;
366
366
  /**
367
- * Creates a new {@link module:engine/view/selection~Selection} instance.
367
+ * Creates a new {@link module:engine/view/selection~ViewSelection} instance.
368
368
  *
369
369
  * ```ts
370
370
  * // Creates empty selection without ranges.
@@ -413,5 +413,5 @@ export default class UpcastWriter {
413
413
  *
414
414
  * @label SELECTABLE
415
415
  */
416
- createSelection(selectable?: Exclude<Selectable, Node>, options?: SelectionOptions): Selection;
416
+ createSelection(selectable?: Exclude<ViewSelectable, ViewNode>, options?: ViewSelectionOptions): ViewSelection;
417
417
  }