@ckeditor/ckeditor5-ui 44.3.0 → 45.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/LICENSE.md +1 -1
  2. package/ckeditor5-metadata.json +1 -1
  3. package/dist/index-editor.css +28 -0
  4. package/dist/index.css +33 -0
  5. package/dist/index.css.map +1 -1
  6. package/dist/index.js +196 -74
  7. package/dist/index.js.map +1 -1
  8. package/dist/translations/be.d.ts +8 -0
  9. package/dist/translations/be.js +5 -0
  10. package/dist/translations/be.umd.js +11 -0
  11. package/lang/translations/be.po +208 -0
  12. package/package.json +12 -6
  13. package/src/arialiveannouncer.js +24 -0
  14. package/src/autocomplete/autocompleteview.js +29 -25
  15. package/src/badge/badge.js +23 -15
  16. package/src/bindings/draggableviewmixin.js +12 -12
  17. package/src/button/buttonview.js +35 -5
  18. package/src/button/filedialogbuttonview.js +11 -1
  19. package/src/button/listitembuttonview.js +14 -10
  20. package/src/button/switchbuttonview.js +4 -0
  21. package/src/collapsible/collapsibleview.d.ts +1 -4
  22. package/src/collapsible/collapsibleview.js +13 -2
  23. package/src/colorgrid/colorgridview.js +18 -2
  24. package/src/colorgrid/colortileview.d.ts +1 -4
  25. package/src/colorgrid/colortileview.js +3 -3
  26. package/src/colorpicker/colorpickerview.js +28 -1
  27. package/src/colorselector/colorgridsfragmentview.js +80 -4
  28. package/src/colorselector/colorpickerfragmentview.js +44 -3
  29. package/src/colorselector/colorselectorview.js +36 -0
  30. package/src/componentfactory.js +8 -4
  31. package/src/dialog/dialog.js +18 -0
  32. package/src/dialog/dialogactionsview.js +20 -0
  33. package/src/dialog/dialogcontentview.js +4 -0
  34. package/src/dialog/dialogview.d.ts +1 -1
  35. package/src/dialog/dialogview.js +56 -11
  36. package/src/dropdown/button/dropdownbuttonview.d.ts +0 -3
  37. package/src/dropdown/button/dropdownbuttonview.js +6 -2
  38. package/src/dropdown/button/splitbuttonview.d.ts +1 -4
  39. package/src/dropdown/button/splitbuttonview.js +27 -3
  40. package/src/dropdown/dropdownpanelview.js +8 -0
  41. package/src/dropdown/dropdownview.js +235 -184
  42. package/src/dropdown/menu/dropdownmenubuttonview.d.ts +0 -3
  43. package/src/dropdown/menu/dropdownmenubuttonview.js +6 -2
  44. package/src/dropdown/menu/dropdownmenulistitembuttonview.js +1 -0
  45. package/src/dropdown/menu/dropdownmenulistitemview.js +4 -0
  46. package/src/dropdown/menu/dropdownmenunestedmenuview.js +31 -8
  47. package/src/dropdown/menu/dropdownmenurootlistview.js +16 -8
  48. package/src/editableui/editableuiview.js +22 -4
  49. package/src/editableui/inline/inlineeditableuiview.js +4 -0
  50. package/src/editorui/accessibilityhelp/accessibilityhelp.js +8 -11
  51. package/src/editorui/bodycollection.js +13 -0
  52. package/src/editorui/boxed/boxededitoruiview.js +14 -0
  53. package/src/editorui/editorui.d.ts +1 -1
  54. package/src/editorui/editorui.js +56 -25
  55. package/src/editorui/editoruiview.d.ts +15 -1
  56. package/src/editorui/editoruiview.js +22 -0
  57. package/src/editorui/evaluationbadge.js +5 -5
  58. package/src/editorui/poweredby.d.ts +1 -4
  59. package/src/editorui/poweredby.js +5 -2
  60. package/src/focuscycler.js +31 -0
  61. package/src/formheader/formheaderview.js +8 -0
  62. package/src/formrow/formrowview.d.ts +57 -0
  63. package/src/formrow/formrowview.js +56 -0
  64. package/src/highlightedtext/highlightedtextview.js +1 -1
  65. package/src/highlightedtext/labelwithhighlightview.js +4 -0
  66. package/src/icon/iconview.js +25 -16
  67. package/src/index.d.ts +1 -0
  68. package/src/index.js +1 -0
  69. package/src/input/inputbase.js +5 -0
  70. package/src/label/labelview.js +5 -0
  71. package/src/labeledfield/labeledfieldview.js +20 -0
  72. package/src/labeledinput/labeledinputview.js +13 -0
  73. package/src/list/listitemgroupview.js +15 -0
  74. package/src/list/listitemview.js +4 -0
  75. package/src/list/listview.js +27 -5
  76. package/src/menubar/menubarmenubuttonview.d.ts +0 -3
  77. package/src/menubar/menubarmenubuttonview.js +6 -2
  78. package/src/menubar/menubarmenupanelview.js +4 -0
  79. package/src/menubar/menubarmenuview.js +23 -6
  80. package/src/menubar/menubarview.d.ts +8 -0
  81. package/src/menubar/menubarview.js +27 -7
  82. package/src/menubar/utils.d.ts +6 -0
  83. package/src/menubar/utils.js +16 -3
  84. package/src/model.js +1 -1
  85. package/src/panel/balloon/balloonpanelview.js +464 -449
  86. package/src/panel/balloon/contextualballoon.js +60 -24
  87. package/src/panel/sticky/stickypanelview.js +14 -0
  88. package/src/search/searchresultsview.js +18 -0
  89. package/src/search/text/searchtextqueryview.d.ts +0 -3
  90. package/src/search/text/searchtextqueryview.js +15 -3
  91. package/src/search/text/searchtextview.js +43 -3
  92. package/src/template.js +69 -1
  93. package/src/textarea/textareaview.js +12 -5
  94. package/src/toolbar/balloon/balloontoolbar.d.ts +1 -1
  95. package/src/toolbar/balloon/balloontoolbar.js +38 -11
  96. package/src/toolbar/block/blocktoolbar.js +24 -8
  97. package/src/toolbar/toolbarview.d.ts +15 -2
  98. package/src/toolbar/toolbarview.js +206 -58
  99. package/src/tooltipmanager.js +50 -32
  100. package/src/view.js +76 -0
  101. package/src/viewcollection.js +4 -0
  102. package/theme/components/form/form.css +87 -0
  103. package/theme/components/formrow/formrow.css +32 -0
  104. package/theme/icons/accessibility.svg +0 -1
  105. package/theme/icons/color-tile-check.svg +0 -1
  106. package/theme/icons/dropdown-arrow.svg +0 -1
  107. package/theme/icons/project-logo.svg +0 -1
@@ -8,8 +8,9 @@
8
8
  import BalloonPanelView from './balloonpanelview.js';
9
9
  import View from '../../view.js';
10
10
  import ButtonView from '../../button/buttonview.js';
11
- import { Plugin, icons } from '@ckeditor/ckeditor5-core';
11
+ import { Plugin } from '@ckeditor/ckeditor5-core';
12
12
  import { CKEditorError, FocusTracker, Rect, toUnit } from '@ckeditor/ckeditor5-utils';
13
+ import { IconNextArrow, IconPreviousArrow } from '@ckeditor/ckeditor5-icons';
13
14
  import '../../../theme/components/panel/balloonrotator.css';
14
15
  import '../../../theme/components/panel/fakepanel.css';
15
16
  const toPx = /* #__PURE__ */ toUnit('px');
@@ -48,6 +49,38 @@ const toPx = /* #__PURE__ */ toUnit('px');
48
49
  * navigation bar. If there is only one stack, the rotator view is transparent (it does not add any UI elements).
49
50
  */
50
51
  export default class ContextualBalloon extends Plugin {
52
+ /**
53
+ * The {@link module:utils/dom/position~Options#limiter position limiter}
54
+ * for the {@link #view balloon}, used when no `limiter` has been passed into {@link #add}
55
+ * or {@link #updatePosition}.
56
+ *
57
+ * By default, a function that obtains the farthest DOM
58
+ * {@link module:engine/view/rooteditableelement~RootEditableElement}
59
+ * of the {@link module:engine/view/document~Document#selection}.
60
+ */
61
+ positionLimiter;
62
+ visibleStack;
63
+ /**
64
+ * The map of views and their stacks.
65
+ */
66
+ _viewToStack = new Map();
67
+ /**
68
+ * The map of IDs and stacks.
69
+ */
70
+ _idToStack = new Map();
71
+ /**
72
+ * The common balloon panel view.
73
+ */
74
+ _view = null;
75
+ /**
76
+ * Rotator view embedded in the contextual balloon.
77
+ * Displays the currently visible view in the balloon and provides navigation for switching stacks.
78
+ */
79
+ _rotatorView = null;
80
+ /**
81
+ * Displays fake panels under the balloon panel view when multiple stacks are added to the balloon.
82
+ */
83
+ _fakePanelsView = null;
51
84
  /**
52
85
  * @inheritDoc
53
86
  */
@@ -65,27 +98,6 @@ export default class ContextualBalloon extends Plugin {
65
98
  */
66
99
  constructor(editor) {
67
100
  super(editor);
68
- /**
69
- * The map of views and their stacks.
70
- */
71
- this._viewToStack = new Map();
72
- /**
73
- * The map of IDs and stacks.
74
- */
75
- this._idToStack = new Map();
76
- /**
77
- * The common balloon panel view.
78
- */
79
- this._view = null;
80
- /**
81
- * Rotator view embedded in the contextual balloon.
82
- * Displays the currently visible view in the balloon and provides navigation for switching stacks.
83
- */
84
- this._rotatorView = null;
85
- /**
86
- * Displays fake panels under the balloon panel view when multiple stacks are added to the balloon.
87
- */
88
- this._fakePanelsView = null;
89
101
  this.positionLimiter = () => {
90
102
  const view = this.editor.editing.view;
91
103
  const viewDocument = view.document;
@@ -401,6 +413,22 @@ export default class ContextualBalloon extends Plugin {
401
413
  * See the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon ContextualBalloon} documentation to learn more.
402
414
  */
403
415
  export class RotatorView extends View {
416
+ /**
417
+ * Used for checking if a view is focused or not.
418
+ */
419
+ focusTracker;
420
+ /**
421
+ * Navigation button for switching the stack to the previous one.
422
+ */
423
+ buttonPrevView;
424
+ /**
425
+ * Navigation button for switching the stack to the next one.
426
+ */
427
+ buttonNextView;
428
+ /**
429
+ * A collection of the child views that creates the rotator content.
430
+ */
431
+ content;
404
432
  /**
405
433
  * @inheritDoc
406
434
  */
@@ -410,8 +438,8 @@ export class RotatorView extends View {
410
438
  const bind = this.bindTemplate;
411
439
  this.set('isNavigationVisible', true);
412
440
  this.focusTracker = new FocusTracker();
413
- this.buttonPrevView = this._createButtonView(t('Previous'), icons.previousArrow);
414
- this.buttonNextView = this._createButtonView(t('Next'), icons.nextArrow);
441
+ this.buttonPrevView = this._createButtonView(t('Previous'), IconPreviousArrow);
442
+ this.buttonNextView = this._createButtonView(t('Next'), IconNextArrow);
415
443
  this.content = this.createCollection();
416
444
  this.setTemplate({
417
445
  tag: 'div',
@@ -508,6 +536,14 @@ export class RotatorView extends View {
508
536
  * Displays additional layers under the balloon when multiple stacks are added to the balloon.
509
537
  */
510
538
  class FakePanelsView extends View {
539
+ /**
540
+ * Collection of the child views which creates fake panel content.
541
+ */
542
+ content;
543
+ /**
544
+ * Context.
545
+ */
546
+ _balloonPanelView;
511
547
  /**
512
548
  * @inheritDoc
513
549
  */
@@ -18,6 +18,20 @@ const toPx = /* #__PURE__ */ toUnit('px');
18
18
  * The sticky panel view class.
19
19
  */
20
20
  export default class StickyPanelView extends View {
21
+ /**
22
+ * Collection of the child views which creates balloon panel contents.
23
+ */
24
+ content;
25
+ /**
26
+ * The panel which accepts children into {@link #content} collection.
27
+ * Also an element which is positioned when {@link #isSticky}.
28
+ */
29
+ contentPanelElement;
30
+ /**
31
+ * A dummy element which visually fills the space as long as the
32
+ * actual panel is sticky. It prevents flickering of the UI.
33
+ */
34
+ _contentPanelPlaceholder;
21
35
  /**
22
36
  * @inheritDoc
23
37
  */
@@ -12,6 +12,24 @@ import { default as FocusCycler } from '../focuscycler.js';
12
12
  * A sub-component of {@link module:ui/search/text/searchtextview~SearchTextView}. It hosts the filtered and the information views.
13
13
  */
14
14
  export default class SearchResultsView extends View {
15
+ /**
16
+ * Tracks information about the DOM focus in the view.
17
+ *
18
+ * @readonly
19
+ */
20
+ focusTracker;
21
+ /**
22
+ * The collection of the child views inside of the list item {@link #element}.
23
+ *
24
+ * @readonly
25
+ */
26
+ children;
27
+ /**
28
+ * Provides the focus management (keyboard navigation) in the view.
29
+ *
30
+ * @readonly
31
+ */
32
+ _focusCycler;
15
33
  /**
16
34
  * @inheritDoc
17
35
  */
@@ -2,9 +2,6 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- /**
6
- * @module ui/search/text/searchtextqueryview
7
- */
8
5
  import ButtonView from '../../button/buttonview.js';
9
6
  import IconView from '../../icon/iconview.js';
10
7
  import LabeledFieldView, { type LabeledFieldViewCreator } from '../../labeledfield/labeledfieldview.js';
@@ -5,11 +5,11 @@
5
5
  /**
6
6
  * @module ui/search/text/searchtextqueryview
7
7
  */
8
+ import { IconCancel, IconLoupe } from '@ckeditor/ckeditor5-icons';
8
9
  import ButtonView from '../../button/buttonview.js';
9
10
  import IconView from '../../icon/iconview.js';
10
11
  import LabeledFieldView from '../../labeledfield/labeledfieldview.js';
11
12
  import { createLabeledInputText } from '../../labeledfield/utils.js';
12
- import { icons } from '@ckeditor/ckeditor5-core';
13
13
  /**
14
14
  * A search input field for the {@link module:ui/search/text/searchtextview~SearchTextView} component.
15
15
  *
@@ -17,6 +17,18 @@ import { icons } from '@ckeditor/ckeditor5-core';
17
17
  * @extends module:ui/labeledfield/labeledfieldview~LabeledFieldView
18
18
  */
19
19
  export default class SearchTextQueryView extends LabeledFieldView {
20
+ /**
21
+ * The loupe icon displayed next to the {@link #fieldView}.
22
+ */
23
+ iconView;
24
+ /**
25
+ * The button that clears and focuses the {@link #fieldView}.
26
+ */
27
+ resetButtonView;
28
+ /**
29
+ * A reference to the view configuration.
30
+ */
31
+ _viewConfig;
20
32
  /**
21
33
  * @inheritDoc
22
34
  */
@@ -32,7 +44,7 @@ export default class SearchTextQueryView extends LabeledFieldView {
32
44
  this._viewConfig = viewConfig;
33
45
  if (this._viewConfig.showIcon) {
34
46
  this.iconView = new IconView();
35
- this.iconView.content = icons.loupe;
47
+ this.iconView.content = IconLoupe;
36
48
  this.fieldWrapperChildren.add(this.iconView, 0);
37
49
  this.extendTemplate({
38
50
  attributes: {
@@ -44,7 +56,7 @@ export default class SearchTextQueryView extends LabeledFieldView {
44
56
  this.resetButtonView = new ButtonView(locale);
45
57
  this.resetButtonView.set({
46
58
  label: t('Clear'),
47
- icon: icons.cancel,
59
+ icon: IconCancel,
48
60
  class: 'ck-search__reset',
49
61
  isVisible: false,
50
62
  tooltip: true
@@ -11,7 +11,7 @@ import { default as SearchTextQueryView } from './searchtextqueryview.js';
11
11
  import SearchInfoView from '../searchinfoview.js';
12
12
  import SearchResultsView from '../searchresultsview.js';
13
13
  import FocusCycler from '../../focuscycler.js';
14
- import { escapeRegExp } from 'lodash-es';
14
+ import { escapeRegExp } from 'es-toolkit/compat';
15
15
  import '../../../theme/components/search/search.css';
16
16
  /**
17
17
  * A search component that allows filtering of an arbitrary view based on a search query
@@ -32,6 +32,46 @@ import '../../../theme/components/search/search.css';
32
32
  * ```
33
33
  */
34
34
  export default class SearchTextView extends View {
35
+ /**
36
+ * Tracks information about the DOM focus in the view.
37
+ *
38
+ * @readonly
39
+ */
40
+ focusTracker;
41
+ /**
42
+ * An instance of the keystroke handler managing user interaction and accessibility.
43
+ *
44
+ * @readonly
45
+ */
46
+ keystrokes;
47
+ /**
48
+ * A view hosting the {@link #filteredView} passed in the configuration and the {@link #infoView}.
49
+ */
50
+ resultsView;
51
+ /**
52
+ * The view that is filtered by the search query.
53
+ */
54
+ filteredView;
55
+ /**
56
+ * The view that displays the information about the search results.
57
+ */
58
+ infoView;
59
+ /**
60
+ * The view that allows the user to enter the search query.
61
+ */
62
+ queryView;
63
+ /**
64
+ * Provides the focus management (keyboard navigation) between {@link #queryView} and {@link #filteredView}.
65
+ *
66
+ * @readonly
67
+ */
68
+ focusCycler;
69
+ /**
70
+ * The cached configuration object.
71
+ *
72
+ * @internal
73
+ */
74
+ _config;
35
75
  /**
36
76
  * Creates an instance of the {@link module:ui/search/text/searchtextview~SearchTextView} class.
37
77
  *
@@ -164,7 +204,7 @@ export default class SearchTextView extends View {
164
204
  const defaultTextConfig = this._config.infoView && this._config.infoView.text;
165
205
  let primaryText, secondaryText;
166
206
  if (data.totalItemsCount) {
167
- if (defaultTextConfig && defaultTextConfig.notFound) {
207
+ if (defaultTextConfig?.notFound) {
168
208
  primaryText = defaultTextConfig.notFound.primary;
169
209
  secondaryText = defaultTextConfig.notFound.secondary;
170
210
  }
@@ -174,7 +214,7 @@ export default class SearchTextView extends View {
174
214
  }
175
215
  }
176
216
  else {
177
- if (defaultTextConfig && defaultTextConfig.noSearchableItems) {
217
+ if (defaultTextConfig?.noSearchableItems) {
178
218
  primaryText = defaultTextConfig.noSearchableItems.primary;
179
219
  secondaryText = defaultTextConfig.noSearchableItems.secondary;
180
220
  }
package/src/template.js CHANGED
@@ -9,7 +9,7 @@
9
9
  import View from './view.js';
10
10
  import ViewCollection from './viewcollection.js';
11
11
  import { CKEditorError, EmitterMixin, isNode, toArray } from '@ckeditor/ckeditor5-utils';
12
- import { isObject, cloneDeepWith } from 'lodash-es';
12
+ import { isObject, cloneDeepWith } from 'es-toolkit/compat';
13
13
  const xhtmlNs = 'http://www.w3.org/1999/xhtml';
14
14
  /**
15
15
  * A basic Template class. It renders a DOM HTML element or text from a
@@ -50,6 +50,46 @@ const xhtmlNs = 'http://www.w3.org/1999/xhtml';
50
50
  * template definitions.
51
51
  */
52
52
  export default class Template extends /* #__PURE__ */ EmitterMixin() {
53
+ ns;
54
+ /**
55
+ * The tag (`tagName`) of this template, e.g. `div`. It also indicates that the template
56
+ * renders to an HTML element.
57
+ */
58
+ tag;
59
+ /**
60
+ * The text of the template. It also indicates that the template renders to a DOM text node.
61
+ */
62
+ text;
63
+ /**
64
+ * The attributes of the template, e.g. `{ id: [ 'ck-id' ] }`, corresponding with
65
+ * the attributes of an HTML element.
66
+ *
67
+ * **Note**: This property only makes sense when {@link #tag} is defined.
68
+ */
69
+ attributes;
70
+ /**
71
+ * The children of the template. They can be either:
72
+ * * independent instances of {@link ~Template} (sub–templates),
73
+ * * native DOM Nodes.
74
+ *
75
+ * **Note**: This property only makes sense when {@link #tag} is defined.
76
+ */
77
+ children;
78
+ /**
79
+ * The DOM event listeners of the template.
80
+ */
81
+ eventListeners;
82
+ /**
83
+ * Indicates whether this particular Template instance has been
84
+ * {@link #render rendered}.
85
+ */
86
+ _isRendered;
87
+ /**
88
+ * The data used by the {@link #revert} method to restore a node to its original state.
89
+ *
90
+ * See: {@link #apply}.
91
+ */
92
+ _revertData;
53
93
  /**
54
94
  * Creates an instance of the {@link ~Template} class.
55
95
  *
@@ -728,6 +768,28 @@ export default class Template extends /* #__PURE__ */ EmitterMixin() {
728
768
  * @internal
729
769
  */
730
770
  export class TemplateBinding {
771
+ /**
772
+ * The name of the {@link module:ui/template~TemplateBinding#observable observed attribute}.
773
+ */
774
+ attribute;
775
+ /**
776
+ * An observable instance of the binding. It either:
777
+ *
778
+ * * provides the attribute with the value,
779
+ * * or passes the event when a corresponding DOM event is fired.
780
+ */
781
+ observable;
782
+ /**
783
+ * An {@link module:utils/emittermixin~Emitter} used by the binding to:
784
+ *
785
+ * * listen to the attribute change in the {@link module:ui/template~TemplateBinding#observable},
786
+ * * or listen to the event in the DOM.
787
+ */
788
+ emitter;
789
+ /**
790
+ * A custom function to process the value of the {@link module:ui/template~TemplateBinding#attribute}.
791
+ */
792
+ callback;
731
793
  /**
732
794
  * Creates an instance of the {@link module:ui/template~TemplateBinding} class.
733
795
  *
@@ -782,6 +844,7 @@ export class TemplateBinding {
782
844
  * @internal
783
845
  */
784
846
  export class TemplateToBinding extends TemplateBinding {
847
+ eventNameOrFunction;
785
848
  constructor(def) {
786
849
  super(def);
787
850
  this.eventNameOrFunction = def.eventNameOrFunction;
@@ -820,6 +883,11 @@ export class TemplateToBinding extends TemplateBinding {
820
883
  * @internal
821
884
  */
822
885
  export class TemplateIfBinding extends TemplateBinding {
886
+ /**
887
+ * The value of the DOM attribute or text to be set if the {@link module:ui/template~TemplateBinding#attribute} in
888
+ * {@link module:ui/template~TemplateBinding#observable} is `true`.
889
+ */
890
+ valueIfTrue;
823
891
  constructor(def) {
824
892
  super(def);
825
893
  this.valueIfTrue = def.valueIfTrue;
@@ -24,16 +24,23 @@ import '../../theme/components/textarea/textarea.css';
24
24
  * ```
25
25
  */
26
26
  export default class TextareaView extends InputBase {
27
+ /**
28
+ * An instance of the resize observer used to detect when the view is visible or not and update
29
+ * its height if any changes that affect it were made while it was invisible.
30
+ *
31
+ * **Note:** Created in {@link #render}.
32
+ */
33
+ _resizeObserver;
34
+ /**
35
+ * A flag that indicates whether the {@link #_updateAutoGrowHeight} method should be called when the view becomes
36
+ * visible again. See {@link #_resizeObserver}.
37
+ */
38
+ _isUpdateAutoGrowHeightPending = false;
27
39
  /**
28
40
  * @inheritDoc
29
41
  */
30
42
  constructor(locale) {
31
43
  super(locale);
32
- /**
33
- * A flag that indicates whether the {@link #_updateAutoGrowHeight} method should be called when the view becomes
34
- * visible again. See {@link #_resizeObserver}.
35
- */
36
- this._isUpdateAutoGrowHeightPending = false;
37
44
  const toPx = toUnit('px');
38
45
  this.set('minRows', 2);
39
46
  this.set('maxRows', 5);
@@ -43,7 +43,7 @@ export default class BalloonToolbar extends Plugin {
43
43
  */
44
44
  private readonly _balloon;
45
45
  /**
46
- * Fires `_selectionChangeDebounced` event using `lodash#debounce`.
46
+ * Fires `_selectionChangeDebounced` event using `es-toolkit#debounce`.
47
47
  *
48
48
  * This event is an internal plugin event which is fired 200 ms after model selection last change.
49
49
  * This is to makes easy test debounced action without need to use `setTimeout`.
@@ -12,7 +12,7 @@ import normalizeToolbarConfig from '../normalizetoolbarconfig.js';
12
12
  import { Plugin } from '@ckeditor/ckeditor5-core';
13
13
  import { FocusTracker, Rect, ResizeObserver, env, global, toUnit } from '@ckeditor/ckeditor5-utils';
14
14
  import { Observer } from '@ckeditor/ckeditor5-engine';
15
- import { debounce } from 'lodash-es';
15
+ import { debounce } from 'es-toolkit/compat';
16
16
  const toPx = /* #__PURE__ */ toUnit('px');
17
17
  /**
18
18
  * The contextual toolbar.
@@ -20,6 +20,43 @@ const toPx = /* #__PURE__ */ toUnit('px');
20
20
  * It uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon contextual balloon plugin}.
21
21
  */
22
22
  export default class BalloonToolbar extends Plugin {
23
+ /**
24
+ * The toolbar view displayed in the balloon.
25
+ */
26
+ toolbarView;
27
+ /**
28
+ * Tracks the focus of the {@link module:ui/editorui/editorui~EditorUI#getEditableElement editable element}
29
+ * and the {@link #toolbarView}. When both are blurred then the toolbar should hide.
30
+ */
31
+ focusTracker;
32
+ /**
33
+ * A cached and normalized `config.balloonToolbar` object.
34
+ */
35
+ _balloonConfig;
36
+ /**
37
+ * An instance of the resize observer that allows to respond to changes in editable's geometry
38
+ * so the toolbar can stay within its boundaries (and group toolbar items that do not fit).
39
+ *
40
+ * **Note**: Used only when `shouldNotGroupWhenFull` was **not** set in the
41
+ * {@link module:core/editor/editorconfig~EditorConfig#balloonToolbar configuration}.
42
+ *
43
+ * **Note:** Created in {@link #init}.
44
+ */
45
+ _resizeObserver = null;
46
+ /**
47
+ * The contextual balloon plugin instance.
48
+ */
49
+ _balloon;
50
+ /**
51
+ * Fires `_selectionChangeDebounced` event using `es-toolkit#debounce`.
52
+ *
53
+ * This event is an internal plugin event which is fired 200 ms after model selection last change.
54
+ * This is to makes easy test debounced action without need to use `setTimeout`.
55
+ *
56
+ * This function is stored as a plugin property to make possible to cancel
57
+ * trailing debounced invocation on destroy.
58
+ */
59
+ _fireSelectionChangeDebounced;
23
60
  /**
24
61
  * @inheritDoc
25
62
  */
@@ -43,16 +80,6 @@ export default class BalloonToolbar extends Plugin {
43
80
  */
44
81
  constructor(editor) {
45
82
  super(editor);
46
- /**
47
- * An instance of the resize observer that allows to respond to changes in editable's geometry
48
- * so the toolbar can stay within its boundaries (and group toolbar items that do not fit).
49
- *
50
- * **Note**: Used only when `shouldNotGroupWhenFull` was **not** set in the
51
- * {@link module:core/editor/editorconfig~EditorConfig#balloonToolbar configuration}.
52
- *
53
- * **Note:** Created in {@link #init}.
54
- */
55
- this._resizeObserver = null;
56
83
  this._balloonConfig = normalizeToolbarConfig(editor.config.get('balloonToolbar'));
57
84
  this.toolbarView = this._createToolbarView();
58
85
  this.focusTracker = new FocusTracker();
@@ -62,6 +62,30 @@ const toPx = /* #__PURE__ */ toUnit('px');
62
62
  * ```
63
63
  */
64
64
  export default class BlockToolbar extends Plugin {
65
+ /**
66
+ * The toolbar view.
67
+ */
68
+ toolbarView;
69
+ /**
70
+ * The balloon panel view, containing the {@link #toolbarView}.
71
+ */
72
+ panelView;
73
+ /**
74
+ * The button view that opens the {@link #toolbarView}.
75
+ */
76
+ buttonView;
77
+ /**
78
+ * An instance of the resize observer that allows to respond to changes in editable's geometry
79
+ * so the toolbar can stay within its boundaries (and group toolbar items that do not fit).
80
+ *
81
+ * **Note**: Used only when `shouldNotGroupWhenFull` was **not** set in the
82
+ * {@link module:core/editor/editorconfig~EditorConfig#blockToolbar configuration}.
83
+ */
84
+ _resizeObserver = null;
85
+ /**
86
+ * A cached and normalized `config.blockToolbar` object.
87
+ */
88
+ _blockToolbarConfig;
65
89
  /**
66
90
  * @inheritDoc
67
91
  */
@@ -79,14 +103,6 @@ export default class BlockToolbar extends Plugin {
79
103
  */
80
104
  constructor(editor) {
81
105
  super(editor);
82
- /**
83
- * An instance of the resize observer that allows to respond to changes in editable's geometry
84
- * so the toolbar can stay within its boundaries (and group toolbar items that do not fit).
85
- *
86
- * **Note**: Used only when `shouldNotGroupWhenFull` was **not** set in the
87
- * {@link module:core/editor/editorconfig~EditorConfig#blockToolbar configuration}.
88
- */
89
- this._resizeObserver = null;
90
106
  this._blockToolbarConfig = normalizeToolbarConfig(this.editor.config.get('blockToolbar'));
91
107
  this.toolbarView = this._createToolbarView();
92
108
  this.panelView = this._createPanelView();
@@ -11,7 +11,7 @@ import type ComponentFactory from '../componentfactory.js';
11
11
  import type ViewCollection from '../viewcollection.js';
12
12
  import type DropdownPanelFocusable from '../dropdown/dropdownpanelfocusable.js';
13
13
  import { FocusTracker, KeystrokeHandler, type Locale } from '@ckeditor/ckeditor5-utils';
14
- import { type ToolbarConfig } from '@ckeditor/ckeditor5-core';
14
+ import type { ToolbarConfig } from '@ckeditor/ckeditor5-core';
15
15
  import '../../theme/components/toolbar/toolbar.css';
16
16
  export declare const NESTED_TOOLBAR_ICONS: Record<string, string | undefined>;
17
17
  /**
@@ -109,6 +109,10 @@ export default class ToolbarView extends View implements DropdownPanelFocusable
109
109
  * @observable
110
110
  */
111
111
  isVertical: boolean;
112
+ /**
113
+ * Indicates whether the toolbar responds to changes in the geometry (e.g. window resize) by grouping excessive items or not.
114
+ */
115
+ isGrouping: boolean;
112
116
  /**
113
117
  * Helps cycling over {@link #focusables focusable items} in the toolbar.
114
118
  */
@@ -118,7 +122,7 @@ export default class ToolbarView extends View implements DropdownPanelFocusable
118
122
  *
119
123
  * See {@link module:ui/toolbar/toolbarview~ToolbarBehavior} to learn more.
120
124
  */
121
- private readonly _behavior;
125
+ private _behavior;
122
126
  /**
123
127
  * Creates an instance of the {@link module:ui/toolbar/toolbarview~ToolbarView} class.
124
128
  *
@@ -154,6 +158,10 @@ export default class ToolbarView extends View implements DropdownPanelFocusable
154
158
  * to this toolbar and all nested ones as well.
155
159
  */
156
160
  fillFromConfig(itemsOrConfig: ToolbarConfig | undefined, factory: ComponentFactory, removeItems?: Array<string>): void;
161
+ /**
162
+ * Changes the behavior of toolbar if it does not fit into the available space.
163
+ */
164
+ switchBehavior(newBehaviorType: 'dynamic' | 'static'): void;
157
165
  /**
158
166
  * A utility that expands the plain toolbar configuration into a list of view items using a given component factory.
159
167
  *
@@ -270,5 +278,10 @@ export interface ToolbarBehavior {
270
278
  * event listeners, free up references, etc.
271
279
  */
272
280
  destroy(): void;
281
+ /**
282
+ * Indicates the type of the toolbar behavior. Dynamic toolbar can hide items that do not fit into the available space.
283
+ * Static toolbar does not hide items and does not respond to the changes of the viewport.
284
+ */
285
+ type: 'dynamic' | 'static';
273
286
  }
274
287
  export {};