@ckeditor/ckeditor5-ui 48.2.0 → 48.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/arialiveannouncer.d.ts +90 -90
  2. package/dist/augmentation.d.ts +86 -86
  3. package/dist/autocomplete/autocompleteview.d.ts +70 -70
  4. package/dist/badge/badge.d.ts +119 -121
  5. package/dist/bindings/addkeyboardhandlingforgrid.d.ts +22 -22
  6. package/dist/bindings/clickoutsidehandler.d.ts +25 -25
  7. package/dist/bindings/csstransitiondisablermixin.d.ts +47 -36
  8. package/dist/bindings/draggableviewmixin.d.ts +45 -37
  9. package/dist/bindings/preventdefault.d.ts +30 -30
  10. package/dist/bindings/submithandler.d.ts +49 -49
  11. package/dist/button/button.d.ts +167 -167
  12. package/dist/button/buttonlabel.d.ts +28 -28
  13. package/dist/button/buttonlabelview.d.ts +26 -26
  14. package/dist/button/buttonview.d.ts +192 -192
  15. package/dist/button/filedialogbuttonview.d.ts +107 -99
  16. package/dist/button/listitembuttonview.d.ts +73 -73
  17. package/dist/button/switchbuttonview.d.ts +40 -40
  18. package/dist/collapsible/collapsibleview.d.ts +63 -63
  19. package/dist/colorgrid/colorgridview.d.ts +117 -117
  20. package/dist/colorgrid/colortileview.d.ts +21 -21
  21. package/dist/colorgrid/utils.d.ts +35 -35
  22. package/dist/colorpicker/colorpickerview.d.ts +155 -157
  23. package/dist/colorpicker/utils.d.ts +37 -37
  24. package/dist/colorselector/colorgridsfragmentview.d.ts +191 -191
  25. package/dist/colorselector/colorpickerfragmentview.d.ts +129 -129
  26. package/dist/colorselector/colorselectorview.d.ts +227 -229
  27. package/dist/colorselector/documentcolorcollection.d.ts +52 -59
  28. package/dist/componentfactory.d.ts +76 -76
  29. package/dist/dialog/dialog.d.ts +311 -288
  30. package/dist/dialog/dialogactionsview.d.ts +62 -62
  31. package/dist/dialog/dialogcontentview.d.ts +22 -22
  32. package/dist/dialog/dialogview.d.ts +255 -251
  33. package/dist/dropdown/button/dropdownbutton.d.ts +17 -17
  34. package/dist/dropdown/button/dropdownbuttonview.d.ts +41 -41
  35. package/dist/dropdown/button/splitbuttonview.d.ts +155 -155
  36. package/dist/dropdown/dropdownpanelfocusable.d.ts +16 -16
  37. package/dist/dropdown/dropdownpanelview.d.ts +56 -56
  38. package/dist/dropdown/dropdownview.d.ts +326 -326
  39. package/dist/dropdown/menu/dropdownmenubehaviors.d.ts +43 -43
  40. package/dist/dropdown/menu/dropdownmenubuttonview.d.ts +29 -29
  41. package/dist/dropdown/menu/dropdownmenulistitembuttonview.d.ts +12 -12
  42. package/dist/dropdown/menu/dropdownmenulistitemview.d.ts +17 -17
  43. package/dist/dropdown/menu/dropdownmenulistview.d.ts +19 -19
  44. package/dist/dropdown/menu/dropdownmenunestedmenupanelview.d.ts +28 -28
  45. package/dist/dropdown/menu/dropdownmenunestedmenuview.d.ts +126 -126
  46. package/dist/dropdown/menu/dropdownmenurootlistview.d.ts +132 -132
  47. package/dist/dropdown/menu/utils.d.ts +112 -112
  48. package/dist/dropdown/utils.d.ts +272 -272
  49. package/dist/editableui/editableuiview.d.ts +78 -78
  50. package/dist/editableui/inline/inlineeditableuiview.d.ts +38 -38
  51. package/dist/editorui/accessibilityhelp/accessibilityhelp.d.ts +50 -50
  52. package/dist/editorui/accessibilityhelp/accessibilityhelpcontentview.d.ts +30 -30
  53. package/dist/editorui/bodycollection.d.ts +86 -86
  54. package/dist/editorui/boxed/boxededitoruiview.d.ts +35 -35
  55. package/dist/editorui/editorui.d.ts +348 -351
  56. package/dist/editorui/editoruiview.d.ts +53 -53
  57. package/dist/editorui/evaluationbadge.d.ts +28 -28
  58. package/dist/editorui/poweredby.d.ts +25 -25
  59. package/dist/focuscycler.d.ts +265 -270
  60. package/dist/formheader/formheaderview.d.ts +53 -53
  61. package/dist/formrow/formrowview.d.ts +52 -52
  62. package/dist/highlightedtext/buttonlabelwithhighlightview.d.ts +25 -25
  63. package/dist/highlightedtext/highlightedtextview.d.ts +33 -33
  64. package/dist/highlightedtext/labelwithhighlightview.d.ts +21 -21
  65. package/dist/icon/iconview.d.ts +83 -83
  66. package/dist/iframe/iframeview.d.ts +42 -42
  67. package/dist/index.css.map +1 -1
  68. package/dist/index.d.ts +136 -136
  69. package/dist/index.js +16467 -17751
  70. package/dist/index.js.map +1 -1
  71. package/dist/input/inputbase.d.ts +114 -114
  72. package/dist/input/inputview.d.ts +28 -28
  73. package/dist/inputnumber/inputnumberview.d.ts +44 -44
  74. package/dist/inputtext/inputtextview.d.ts +13 -13
  75. package/dist/label/labelview.d.ts +31 -31
  76. package/dist/labeledfield/labeledfieldview.d.ts +180 -180
  77. package/dist/labeledfield/utils.d.ts +112 -112
  78. package/dist/labeledinput/labeledinputview.d.ts +120 -120
  79. package/dist/legacyerrors.d.ts +0 -4
  80. package/dist/list/listitemgroupview.d.ts +54 -54
  81. package/dist/list/listitemview.d.ts +31 -31
  82. package/dist/list/listseparatorview.d.ts +13 -13
  83. package/dist/list/listview.d.ts +119 -119
  84. package/dist/menubar/menubarmenubuttonview.d.ts +28 -28
  85. package/dist/menubar/menubarmenulistitembuttonview.d.ts +16 -16
  86. package/dist/menubar/menubarmenulistitemfiledialogbuttonview.d.ts +18 -18
  87. package/dist/menubar/menubarmenulistitemview.d.ts +20 -20
  88. package/dist/menubar/menubarmenulistview.d.ts +24 -24
  89. package/dist/menubar/menubarmenupanelview.d.ts +47 -47
  90. package/dist/menubar/menubarmenuview.d.ts +113 -113
  91. package/dist/menubar/menubarview.d.ts +145 -145
  92. package/dist/menubar/utils.d.ts +455 -455
  93. package/dist/model.d.ts +19 -18
  94. package/dist/notification/notification.d.ts +200 -200
  95. package/dist/panel/balloon/balloonpanelview.d.ts +692 -692
  96. package/dist/panel/balloon/contextualballoon.d.ts +298 -298
  97. package/dist/panel/sticky/stickypanelview.d.ts +151 -151
  98. package/dist/search/filteredview.d.ts +23 -23
  99. package/dist/search/filtergroupanditemnames.d.ts +11 -11
  100. package/dist/search/searchinfoview.d.ts +39 -39
  101. package/dist/search/searchresultsview.d.ts +49 -49
  102. package/dist/search/text/searchtextqueryview.d.ts +63 -63
  103. package/dist/search/text/searchtextview.d.ts +203 -203
  104. package/dist/spinner/spinnerview.d.ts +20 -20
  105. package/dist/template.d.ts +897 -902
  106. package/dist/textarea/textareaview.d.ts +96 -96
  107. package/dist/toolbar/balloon/balloontoolbar.d.ts +122 -122
  108. package/dist/toolbar/block/blockbuttonview.d.ts +30 -30
  109. package/dist/toolbar/block/blocktoolbar.d.ts +166 -166
  110. package/dist/toolbar/normalizetoolbarconfig.d.ts +35 -35
  111. package/dist/toolbar/toolbarlinebreakview.d.ts +13 -13
  112. package/dist/toolbar/toolbarseparatorview.d.ts +13 -13
  113. package/dist/toolbar/toolbarview.d.ts +271 -271
  114. package/dist/tooltipmanager.d.ts +190 -193
  115. package/dist/view.d.ts +385 -388
  116. package/dist/viewcollection.d.ts +134 -134
  117. package/package.json +6 -6
@@ -1,369 +1,366 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module ui/editorui/editorui
7
- */
8
- import { ComponentFactory } from '../componentfactory.js';
9
- import { TooltipManager } from '../tooltipmanager.js';
10
- import { PoweredBy } from './poweredby.js';
11
- import { EvaluationBadge } from './evaluationbadge.js';
12
- import { AriaLiveAnnouncer } from '../arialiveannouncer.js';
13
- import { type EditorUIView } from './editoruiview.js';
14
- import { type ToolbarView } from '../toolbar/toolbarview.js';
15
- import { FocusTracker } from '@ckeditor/ckeditor5-utils';
16
- import type { Editor, ViewportOffsetConfig } from '@ckeditor/ckeditor5-core';
17
- import type { MenuBarView, MenuBarConfigAddedGroup, MenuBarConfigAddedItem, MenuBarConfigAddedMenu } from '../menubar/menubarview.js';
18
- declare const EditorUI_base: {
19
- new (): import("@ckeditor/ckeditor5-utils").Observable;
20
- prototype: import("@ckeditor/ckeditor5-utils").Observable;
21
- };
6
+ * @module ui/editorui/editorui
7
+ */
8
+ import { ComponentFactory } from "../componentfactory.js";
9
+ import { TooltipManager } from "../tooltipmanager.js";
10
+ import { PoweredBy } from "./poweredby.js";
11
+ import { EvaluationBadge } from "./evaluationbadge.js";
12
+ import { AriaLiveAnnouncer } from "../arialiveannouncer.js";
13
+ import { type EditorUIView } from "./editoruiview.js";
14
+ import { type ToolbarView } from "../toolbar/toolbarview.js";
15
+ import { FocusTracker, type ObservableMixinConstructor } from "@ckeditor/ckeditor5-utils";
16
+ import type { Editor, ViewportOffsetConfig } from "@ckeditor/ckeditor5-core";
17
+ import type { MenuBarView, MenuBarConfigAddedGroup, MenuBarConfigAddedItem, MenuBarConfigAddedMenu } from "../menubar/menubarview.js";
18
+ declare const EditorUIBase: ObservableMixinConstructor;
22
19
  /**
23
- * A class providing the minimal interface that is required to successfully bootstrap any editor UI.
24
- */
25
- export declare abstract class EditorUI extends /* #__PURE__ */ EditorUI_base {
26
- /**
27
- * The editor that the UI belongs to.
28
- */
29
- readonly editor: Editor;
30
- /**
31
- * An instance of the {@link module:ui/componentfactory~ComponentFactory}, a registry used by plugins
32
- * to register factories of specific UI components.
33
- */
34
- readonly componentFactory: ComponentFactory;
35
- /**
36
- * Stores the information about the editor UI focus and propagates it so various plugins and components
37
- * are unified as a focus group.
38
- */
39
- readonly focusTracker: FocusTracker;
40
- /**
41
- * Manages the tooltips displayed on mouseover and focus across the UI.
42
- */
43
- readonly tooltipManager: TooltipManager;
44
- /**
45
- * A helper that enables the "powered by" feature in the editor and renders a link to the project's webpage.
46
- */
47
- readonly poweredBy: PoweredBy;
48
- /**
49
- * A helper that enables the "evaluation badge" feature in the editor.
50
- */
51
- readonly evaluationBadge: EvaluationBadge;
52
- /**
53
- * A helper that manages the content of an `aria-live` regions used by editor features to announce status changes
54
- * to screen readers.
55
- */
56
- readonly ariaLiveAnnouncer: AriaLiveAnnouncer;
57
- /**
58
- * Indicates the UI is ready. Set `true` after {@link #event:ready} event is fired.
59
- *
60
- * @readonly
61
- * @default false
62
- */
63
- isReady: boolean;
64
- abstract get view(): EditorUIView;
65
- /**
66
- * Stores viewport offsets from every direction.
67
- *
68
- * Viewport offset can be used to constrain balloons or other UI elements into an element smaller than the viewport.
69
- * This can be useful if there are any other absolutely positioned elements that may interfere with editor UI.
70
- *
71
- * Example `editor.ui.viewportOffset` returns:
72
- *
73
- * ```js
74
- * {
75
- * top: 50,
76
- * right: 50,
77
- * bottom: 50,
78
- * left: 50,
79
- * visualTop: 50
80
- * }
81
- * ```
82
- *
83
- * This property can be overriden after editor already being initialized:
84
- *
85
- * ```js
86
- * editor.ui.viewportOffset = {
87
- * top: 100,
88
- * right: 0,
89
- * bottom: 0,
90
- * left: 0
91
- * };
92
- * ```
93
- *
94
- * @observable
95
- */
96
- viewportOffset: ViewportOffset;
97
- /**
98
- * Stores all editable elements used by the editor instance.
99
- */
100
- private _editableElementsMap;
101
- /**
102
- * All available & focusable toolbars.
103
- */
104
- private _focusableToolbarDefinitions;
105
- /**
106
- * All additional menu bar items, groups or menus that have their default location defined.
107
- */
108
- private _extraMenuBarElements;
109
- /**
110
- * The last focused element to which focus should return on `Esc` press.
111
- */
112
- private _lastFocusedForeignElement;
113
- /**
114
- * The DOM emitter instance used for visual viewport watching.
115
- */
116
- private _domEmitter?;
117
- /**
118
- * Creates an instance of the editor UI class.
119
- *
120
- * @param editor The editor instance.
121
- */
122
- constructor(editor: Editor);
123
- /**
124
- * The main (outermost) DOM element of the editor UI.
125
- *
126
- * For example, in {@link module:editor-classic/classiceditor~ClassicEditor} it is a `<div>` which
127
- * wraps the editable element and the toolbar. In {@link module:editor-inline/inlineeditor~InlineEditor}
128
- * it is the editable element itself (as there is no other wrapper). However, in
129
- * {@link module:editor-decoupled/decouplededitor~DecoupledEditor} it is set to `null` because this editor does not
130
- * come with a single "main" HTML element (its editable element and toolbar are separate).
131
- *
132
- * This property can be understood as a shorthand for retrieving the element that a specific editor integration
133
- * considers to be its main DOM element.
134
- */
135
- get element(): HTMLElement | null;
136
- /**
137
- * Fires the {@link module:ui/editorui/editorui~EditorUI#event:update `update`} event.
138
- *
139
- * This method should be called when the editor UI (e.g. positions of its balloons) needs to be updated due to
140
- * some environmental change which CKEditor 5 is not aware of (e.g. resize of a container in which it is used).
141
- */
142
- update(): void;
143
- /**
144
- * Destroys the UI.
145
- */
146
- destroy(): void;
147
- /**
148
- * Stores the native DOM editable element used by the editor under a unique name.
149
- *
150
- * Also, registers the element in the editor to maintain the accessibility of the UI. When the user is editing text in a focusable
151
- * editable area, they can use the <kbd>Alt</kbd> + <kbd>F10</kbd> keystroke to navigate over editor toolbars. See {@link #addToolbar}.
152
- *
153
- * @param rootName The unique name of the editable element.
154
- * @param domElement The native DOM editable element.
155
- */
156
- setEditableElement(rootName: string, domElement: HTMLElement): void;
157
- /**
158
- * Removes the editable from the editor UI. Removes all handlers added by {@link #setEditableElement}.
159
- *
160
- * @param rootName The name of the editable element to remove.
161
- */
162
- removeEditableElement(rootName: string): void;
163
- /**
164
- * Returns the editable editor element with the given name or null if editable does not exist.
165
- *
166
- * @param rootName The editable name.
167
- */
168
- getEditableElement(rootName?: string): HTMLElement | undefined;
169
- /**
170
- * Returns array of names of all editor editable elements.
171
- */
172
- getEditableElementsNames(): IterableIterator<string>;
173
- /**
174
- * Adds a toolbar to the editor UI. Used primarily to maintain the accessibility of the UI.
175
- *
176
- * Focusable toolbars can be accessed (focused) by users by pressing the <kbd>Alt</kbd> + <kbd>F10</kbd> keystroke.
177
- * Successive keystroke presses navigate over available toolbars.
178
- *
179
- * @param toolbarView A instance of the toolbar to be registered.
180
- */
181
- addToolbar(toolbarView: ToolbarView, options?: FocusableToolbarOptions): void;
182
- /**
183
- * Registers an extra menu bar element, which could be a single item, a group of items, or a menu containing groups.
184
- *
185
- * ```ts
186
- * // Register a new menu bar item.
187
- * editor.ui.extendMenuBar( {
188
- * item: 'menuBar:customFunctionButton',
189
- * position: 'after:menuBar:bold'
190
- * } );
191
- *
192
- * // Register a new menu bar group.
193
- * editor.ui.extendMenuBar( {
194
- * group: {
195
- * groupId: 'customGroup',
196
- * items: [
197
- * 'menuBar:customFunctionButton'
198
- * ]
199
- * },
200
- * position: 'start:help'
201
- * } );
202
- *
203
- * // Register a new menu bar menu.
204
- * editor.ui.extendMenuBar( {
205
- * menu: {
206
- * menuId: 'customMenu',
207
- * label: 'customMenu',
208
- * groups: [
209
- * {
210
- * groupId: 'customGroup',
211
- * items: [
212
- * 'menuBar:customFunctionButton'
213
- * ]
214
- * }
215
- * ]
216
- * },
217
- * position: 'after:help'
218
- * } );
219
- * ```
220
- */
221
- extendMenuBar(config: MenuBarConfigAddedItem | MenuBarConfigAddedGroup | MenuBarConfigAddedMenu): void;
222
- /**
223
- * Initializes menu bar.
224
- */
225
- initMenuBar(menuBarView: MenuBarView): void;
226
- /**
227
- * Returns viewport offsets object:
228
- *
229
- * ```js
230
- * {
231
- * top: Number,
232
- * right: Number,
233
- * bottom: Number,
234
- * left: Number
235
- * }
236
- * ```
237
- *
238
- * Only top property is currently supported.
239
- */
240
- private _readViewportOffsetFromConfig;
241
- /**
242
- * Starts listening for <kbd>Alt</kbd> + <kbd>F10</kbd> and <kbd>Esc</kbd> keystrokes in the context of focusable
243
- * {@link #setEditableElement editable elements} and {@link #addToolbar toolbars}
244
- * to allow users navigate across the UI.
245
- */
246
- private _initFocusTracking;
247
- /**
248
- * Saves last focused element that doen not belong to editing view to restore focus on `Esc`.
249
- */
250
- private _saveLastFocusedForeignElement;
251
- /**
252
- * Returns definitions of toolbars that could potentially be focused, sorted by their importance for the user.
253
- *
254
- * Focusable toolbars candidates are either:
255
- * * already visible,
256
- * * have `beforeFocus()` set in their {@link module:ui/editorui/editorui~FocusableToolbarDefinition definition} that suggests that
257
- * they might show up when called. Keep in mind that determining whether a toolbar will show up (and become focusable) is impossible
258
- * at this stage because it depends on its implementation, that in turn depends on the editing context (selection).
259
- *
260
- * **Note**: Contextual toolbars take precedence over regular toolbars.
261
- */
262
- private _getFocusableCandidateToolbarDefinitions;
263
- /**
264
- * Returns a definition of the toolbar that is currently visible and focused (one of its children has focus).
265
- *
266
- * `null` is returned when no toolbar is currently focused.
267
- */
268
- private _getCurrentFocusedToolbarDefinition;
269
- /**
270
- * Focuses a focusable toolbar candidate using its definition.
271
- *
272
- * @param candidateToolbarDefinition A definition of the toolbar to focus.
273
- * @returns `true` when the toolbar candidate was focused. `false` otherwise.
274
- */
275
- private _focusFocusableCandidateToolbar;
276
- /**
277
- * Provides an integration between {@link #viewportOffset} and {@link module:utils/dom/scroll~scrollViewportToShowTarget}.
278
- * It allows the UI-agnostic engine method to consider user-configured viewport offsets specific for the integration.
279
- *
280
- * @param evt The `scrollToTheSelection` event info.
281
- * @param data The payload carried by the `scrollToTheSelection` event.
282
- */
283
- private _handleScrollToTheSelection;
284
- /**
285
- * Ensures that the focus tracker is aware of all views' DOM elements in the body collection.
286
- */
287
- private _bindBodyCollectionWithFocusTracker;
288
- /**
289
- * Set initial viewport offset and setup visualTop augmentation.
290
- */
291
- private _initViewportOffset;
292
- /**
293
- * Listen to visual viewport changes and update the viewportOffset with the visualTop property
294
- * according to the visible part of it (visual viewport).
295
- */
296
- private _initVisualViewportSupport;
297
- /**
298
- * Calculate the viewport top offset according to the visible part of it (visual viewport).
299
- */
300
- private _getVisualViewportTopOffset;
20
+ * A class providing the minimal interface that is required to successfully bootstrap any editor UI.
21
+ */
22
+ export declare abstract class EditorUI extends EditorUIBase {
23
+ /**
24
+ * The editor that the UI belongs to.
25
+ */
26
+ readonly editor: Editor;
27
+ /**
28
+ * An instance of the {@link module:ui/componentfactory~ComponentFactory}, a registry used by plugins
29
+ * to register factories of specific UI components.
30
+ */
31
+ readonly componentFactory: ComponentFactory;
32
+ /**
33
+ * Stores the information about the editor UI focus and propagates it so various plugins and components
34
+ * are unified as a focus group.
35
+ */
36
+ readonly focusTracker: FocusTracker;
37
+ /**
38
+ * Manages the tooltips displayed on mouseover and focus across the UI.
39
+ */
40
+ readonly tooltipManager: TooltipManager;
41
+ /**
42
+ * A helper that enables the "powered by" feature in the editor and renders a link to the project's webpage.
43
+ */
44
+ readonly poweredBy: PoweredBy;
45
+ /**
46
+ * A helper that enables the "evaluation badge" feature in the editor.
47
+ */
48
+ readonly evaluationBadge: EvaluationBadge;
49
+ /**
50
+ * A helper that manages the content of an `aria-live` regions used by editor features to announce status changes
51
+ * to screen readers.
52
+ */
53
+ readonly ariaLiveAnnouncer: AriaLiveAnnouncer;
54
+ /**
55
+ * Indicates the UI is ready. Set `true` after {@link #event:ready} event is fired.
56
+ *
57
+ * @readonly
58
+ * @default false
59
+ */
60
+ isReady: boolean;
61
+ abstract get view(): EditorUIView;
62
+ /**
63
+ * Stores viewport offsets from every direction.
64
+ *
65
+ * Viewport offset can be used to constrain balloons or other UI elements into an element smaller than the viewport.
66
+ * This can be useful if there are any other absolutely positioned elements that may interfere with editor UI.
67
+ *
68
+ * Example `editor.ui.viewportOffset` returns:
69
+ *
70
+ * ```js
71
+ * {
72
+ * top: 50,
73
+ * right: 50,
74
+ * bottom: 50,
75
+ * left: 50,
76
+ * visualTop: 50
77
+ * }
78
+ * ```
79
+ *
80
+ * This property can be overriden after editor already being initialized:
81
+ *
82
+ * ```js
83
+ * editor.ui.viewportOffset = {
84
+ * top: 100,
85
+ * right: 0,
86
+ * bottom: 0,
87
+ * left: 0
88
+ * };
89
+ * ```
90
+ *
91
+ * @observable
92
+ */
93
+ viewportOffset: ViewportOffset;
94
+ /**
95
+ * Stores all editable elements used by the editor instance.
96
+ */
97
+ private _editableElementsMap;
98
+ /**
99
+ * All available & focusable toolbars.
100
+ */
101
+ private _focusableToolbarDefinitions;
102
+ /**
103
+ * All additional menu bar items, groups or menus that have their default location defined.
104
+ */
105
+ private _extraMenuBarElements;
106
+ /**
107
+ * The last focused element to which focus should return on `Esc` press.
108
+ */
109
+ private _lastFocusedForeignElement;
110
+ /**
111
+ * The DOM emitter instance used for visual viewport watching.
112
+ */
113
+ private _domEmitter?;
114
+ /**
115
+ * Creates an instance of the editor UI class.
116
+ *
117
+ * @param editor The editor instance.
118
+ */
119
+ constructor(editor: Editor);
120
+ /**
121
+ * The main (outermost) DOM element of the editor UI.
122
+ *
123
+ * For example, in {@link module:editor-classic/classiceditor~ClassicEditor} it is a `<div>` which
124
+ * wraps the editable element and the toolbar. In {@link module:editor-inline/inlineeditor~InlineEditor}
125
+ * it is the editable element itself (as there is no other wrapper). However, in
126
+ * {@link module:editor-decoupled/decouplededitor~DecoupledEditor} it is set to `null` because this editor does not
127
+ * come with a single "main" HTML element (its editable element and toolbar are separate).
128
+ *
129
+ * This property can be understood as a shorthand for retrieving the element that a specific editor integration
130
+ * considers to be its main DOM element.
131
+ */
132
+ get element(): HTMLElement | null;
133
+ /**
134
+ * Fires the {@link module:ui/editorui/editorui~EditorUI#event:update `update`} event.
135
+ *
136
+ * This method should be called when the editor UI (e.g. positions of its balloons) needs to be updated due to
137
+ * some environmental change which CKEditor 5 is not aware of (e.g. resize of a container in which it is used).
138
+ */
139
+ update(): void;
140
+ /**
141
+ * Destroys the UI.
142
+ */
143
+ destroy(): void;
144
+ /**
145
+ * Stores the native DOM editable element used by the editor under a unique name.
146
+ *
147
+ * Also, registers the element in the editor to maintain the accessibility of the UI. When the user is editing text in a focusable
148
+ * editable area, they can use the <kbd>Alt</kbd> + <kbd>F10</kbd> keystroke to navigate over editor toolbars. See {@link #addToolbar}.
149
+ *
150
+ * @param rootName The unique name of the editable element.
151
+ * @param domElement The native DOM editable element.
152
+ */
153
+ setEditableElement(rootName: string, domElement: HTMLElement): void;
154
+ /**
155
+ * Removes the editable from the editor UI. Removes all handlers added by {@link #setEditableElement}.
156
+ *
157
+ * @param rootName The name of the editable element to remove.
158
+ */
159
+ removeEditableElement(rootName: string): void;
160
+ /**
161
+ * Returns the editable editor element with the given name or null if editable does not exist.
162
+ *
163
+ * @param rootName The editable name.
164
+ */
165
+ getEditableElement(rootName?: string): HTMLElement | undefined;
166
+ /**
167
+ * Returns array of names of all editor editable elements.
168
+ */
169
+ getEditableElementsNames(): IterableIterator<string>;
170
+ /**
171
+ * Adds a toolbar to the editor UI. Used primarily to maintain the accessibility of the UI.
172
+ *
173
+ * Focusable toolbars can be accessed (focused) by users by pressing the <kbd>Alt</kbd> + <kbd>F10</kbd> keystroke.
174
+ * Successive keystroke presses navigate over available toolbars.
175
+ *
176
+ * @param toolbarView A instance of the toolbar to be registered.
177
+ */
178
+ addToolbar(toolbarView: ToolbarView, options?: FocusableToolbarOptions): void;
179
+ /**
180
+ * Registers an extra menu bar element, which could be a single item, a group of items, or a menu containing groups.
181
+ *
182
+ * ```ts
183
+ * // Register a new menu bar item.
184
+ * editor.ui.extendMenuBar( {
185
+ * item: 'menuBar:customFunctionButton',
186
+ * position: 'after:menuBar:bold'
187
+ * } );
188
+ *
189
+ * // Register a new menu bar group.
190
+ * editor.ui.extendMenuBar( {
191
+ * group: {
192
+ * groupId: 'customGroup',
193
+ * items: [
194
+ * 'menuBar:customFunctionButton'
195
+ * ]
196
+ * },
197
+ * position: 'start:help'
198
+ * } );
199
+ *
200
+ * // Register a new menu bar menu.
201
+ * editor.ui.extendMenuBar( {
202
+ * menu: {
203
+ * menuId: 'customMenu',
204
+ * label: 'customMenu',
205
+ * groups: [
206
+ * {
207
+ * groupId: 'customGroup',
208
+ * items: [
209
+ * 'menuBar:customFunctionButton'
210
+ * ]
211
+ * }
212
+ * ]
213
+ * },
214
+ * position: 'after:help'
215
+ * } );
216
+ * ```
217
+ */
218
+ extendMenuBar(config: MenuBarConfigAddedItem | MenuBarConfigAddedGroup | MenuBarConfigAddedMenu): void;
219
+ /**
220
+ * Initializes menu bar.
221
+ */
222
+ initMenuBar(menuBarView: MenuBarView): void;
223
+ /**
224
+ * Returns viewport offsets object:
225
+ *
226
+ * ```js
227
+ * {
228
+ * top: Number,
229
+ * right: Number,
230
+ * bottom: Number,
231
+ * left: Number
232
+ * }
233
+ * ```
234
+ *
235
+ * Only top property is currently supported.
236
+ */
237
+ private _readViewportOffsetFromConfig;
238
+ /**
239
+ * Starts listening for <kbd>Alt</kbd> + <kbd>F10</kbd> and <kbd>Esc</kbd> keystrokes in the context of focusable
240
+ * {@link #setEditableElement editable elements} and {@link #addToolbar toolbars}
241
+ * to allow users navigate across the UI.
242
+ */
243
+ private _initFocusTracking;
244
+ /**
245
+ * Saves last focused element that doen not belong to editing view to restore focus on `Esc`.
246
+ */
247
+ private _saveLastFocusedForeignElement;
248
+ /**
249
+ * Returns definitions of toolbars that could potentially be focused, sorted by their importance for the user.
250
+ *
251
+ * Focusable toolbars candidates are either:
252
+ * * already visible,
253
+ * * have `beforeFocus()` set in their {@link module:ui/editorui/editorui~FocusableToolbarDefinition definition} that suggests that
254
+ * they might show up when called. Keep in mind that determining whether a toolbar will show up (and become focusable) is impossible
255
+ * at this stage because it depends on its implementation, that in turn depends on the editing context (selection).
256
+ *
257
+ * **Note**: Contextual toolbars take precedence over regular toolbars.
258
+ */
259
+ private _getFocusableCandidateToolbarDefinitions;
260
+ /**
261
+ * Returns a definition of the toolbar that is currently visible and focused (one of its children has focus).
262
+ *
263
+ * `null` is returned when no toolbar is currently focused.
264
+ */
265
+ private _getCurrentFocusedToolbarDefinition;
266
+ /**
267
+ * Focuses a focusable toolbar candidate using its definition.
268
+ *
269
+ * @param candidateToolbarDefinition A definition of the toolbar to focus.
270
+ * @returns `true` when the toolbar candidate was focused. `false` otherwise.
271
+ */
272
+ private _focusFocusableCandidateToolbar;
273
+ /**
274
+ * Provides an integration between {@link #viewportOffset} and {@link module:utils/dom/scroll~scrollViewportToShowTarget}.
275
+ * It allows the UI-agnostic engine method to consider user-configured viewport offsets specific for the integration.
276
+ *
277
+ * @param evt The `scrollToTheSelection` event info.
278
+ * @param data The payload carried by the `scrollToTheSelection` event.
279
+ */
280
+ private _handleScrollToTheSelection;
281
+ /**
282
+ * Ensures that the focus tracker is aware of all views' DOM elements in the body collection.
283
+ */
284
+ private _bindBodyCollectionWithFocusTracker;
285
+ /**
286
+ * Set initial viewport offset and setup visualTop augmentation.
287
+ */
288
+ private _initViewportOffset;
289
+ /**
290
+ * Listen to visual viewport changes and update the viewportOffset with the visualTop property
291
+ * according to the visible part of it (visual viewport).
292
+ */
293
+ private _initVisualViewportSupport;
294
+ /**
295
+ * Calculate the viewport top offset according to the visible part of it (visual viewport).
296
+ */
297
+ private _getVisualViewportTopOffset;
301
298
  }
302
299
  /**
303
- * Fired when the editor UI is ready.
304
- *
305
- * Fired before {@link module:engine/controller/datacontroller~DataController#event:ready}.
306
- *
307
- * @eventName ~EditorUI#ready
308
- */
300
+ * Fired when the editor UI is ready.
301
+ *
302
+ * Fired before {@link module:engine/controller/datacontroller~DataController#event:ready}.
303
+ *
304
+ * @eventName ~EditorUI#ready
305
+ */
309
306
  export type EditorUIReadyEvent = {
310
- name: 'ready';
311
- args: [];
307
+ name: "ready";
308
+ args: [];
312
309
  };
313
310
  /**
314
- * Fired whenever the UI (all related components) should be refreshed.
315
- *
316
- * **Note:**: The event is fired after each {@link module:engine/view/document~ViewDocument#event:layoutChanged}.
317
- * It can also be fired manually via the {@link module:ui/editorui/editorui~EditorUI#update} method.
318
- *
319
- * @eventName ~EditorUI#update
320
- */
311
+ * Fired whenever the UI (all related components) should be refreshed.
312
+ *
313
+ * **Note:**: The event is fired after each {@link module:engine/view/document~ViewDocument#event:layoutChanged}.
314
+ * It can also be fired manually via the {@link module:ui/editorui/editorui~EditorUI#update} method.
315
+ *
316
+ * @eventName ~EditorUI#update
317
+ */
321
318
  export type EditorUIUpdateEvent = {
322
- name: 'update';
323
- args: [];
319
+ name: "update";
320
+ args: [];
324
321
  };
325
322
  /**
326
- * A definition of a focusable toolbar. Used by {@link module:ui/editorui/editorui~EditorUI#addToolbar}.
327
- */
323
+ * A definition of a focusable toolbar. Used by {@link module:ui/editorui/editorui~EditorUI#addToolbar}.
324
+ */
328
325
  export interface FocusableToolbarDefinition {
329
- /**
330
- * An instance of a focusable toolbar view.
331
- */
332
- toolbarView: ToolbarView;
333
- /**
334
- * Options of a focusable toolbar view:
335
- *
336
- * * `isContextual`: Marks the higher priority toolbar. For example when there are 2 visible toolbars,
337
- * it allows to distinguish which toolbar should be focused first after the `alt+f10` keystroke
338
- * * `beforeFocus`: A callback executed before the `ToolbarView` gains focus upon the `Alt+F10` keystroke.
339
- * * `afterBlur`: A callback executed after `ToolbarView` loses focus upon `Esc` keystroke but before
340
- * the focus goes back to the `origin`.
341
- */
342
- options: FocusableToolbarOptions;
326
+ /**
327
+ * An instance of a focusable toolbar view.
328
+ */
329
+ toolbarView: ToolbarView;
330
+ /**
331
+ * Options of a focusable toolbar view:
332
+ *
333
+ * * `isContextual`: Marks the higher priority toolbar. For example when there are 2 visible toolbars,
334
+ * it allows to distinguish which toolbar should be focused first after the `alt+f10` keystroke
335
+ * * `beforeFocus`: A callback executed before the `ToolbarView` gains focus upon the `Alt+F10` keystroke.
336
+ * * `afterBlur`: A callback executed after `ToolbarView` loses focus upon `Esc` keystroke but before
337
+ * the focus goes back to the `origin`.
338
+ */
339
+ options: FocusableToolbarOptions;
343
340
  }
344
341
  export interface FocusableToolbarOptions {
345
- /**
346
- * Set `true` if the toolbar is attached to the content of the editor. Such toolbar takes
347
- * a precedence over other toolbars when a user pressed <kbd>Alt</kbd> + <kbd>F10</kbd>.
348
- */
349
- isContextual?: boolean;
350
- /**
351
- * Specify a callback executed before the toolbar instance DOM element gains focus
352
- * upon the <kbd>Alt</kbd> + <kbd>F10</kbd> keystroke.
353
- */
354
- beforeFocus?: () => void;
355
- /**
356
- * Specify a callback executed after the toolbar instance DOM element loses focus upon
357
- * <kbd>Esc</kbd> keystroke but before the focus goes back to the {@link ~EditorUI#setEditableElement editable element}.
358
- */
359
- afterBlur?: () => void;
342
+ /**
343
+ * Set `true` if the toolbar is attached to the content of the editor. Such toolbar takes
344
+ * a precedence over other toolbars when a user pressed <kbd>Alt</kbd> + <kbd>F10</kbd>.
345
+ */
346
+ isContextual?: boolean;
347
+ /**
348
+ * Specify a callback executed before the toolbar instance DOM element gains focus
349
+ * upon the <kbd>Alt</kbd> + <kbd>F10</kbd> keystroke.
350
+ */
351
+ beforeFocus?: () => void;
352
+ /**
353
+ * Specify a callback executed after the toolbar instance DOM element loses focus upon
354
+ * <kbd>Esc</kbd> keystroke but before the focus goes back to the {@link ~EditorUI#setEditableElement editable element}.
355
+ */
356
+ afterBlur?: () => void;
360
357
  }
361
358
  export interface ViewportOffset extends ViewportOffsetConfig {
362
- /**
363
- * The top offset of the visual viewport.
364
- *
365
- * This value is calculated based on the visual viewport position.
366
- */
367
- visualTop?: number;
359
+ /**
360
+ * The top offset of the visual viewport.
361
+ *
362
+ * This value is calculated based on the visual viewport position.
363
+ */
364
+ visualTop?: number;
368
365
  }
369
366
  export {};